function fopen - file functionthe permission


Function fopen - file function:

The permission string in the call to the fopen function identifies that the file is opened for writing to it. Just as when reading from a file, the answer from fopen and fclose must really be checked to make sure that they were successful. The fopen function tries to open the file for writing. If the files already exist, the contents are removed so it is as if the file had not existed.

 

When the file does notpresently exist (that would be the norm), a new file is generated. The fopen could fail, for illustration, if there isn't space to generate this new file.

To view what was written to the file, we could then open it and loop it to read each line by using fgetl:

 

>> fid = fopen('tryt.txt');

>> while  feof(fid)

    aline = fgetl(fid)

   end

aline =

The loop variable is 1

aline =

The loop variable is 2

aline =

The loop variable is 3

>> fclose(fid);

Request for Solution File

Ask an Expert for Answer!!
Applications of MATLAB: function fopen - file functionthe permission
Reference No:- TGS0175129

Expected delivery within 24 Hours