reading from filesthere are many lower level


Reading from Files:

There are many lower level functions which read from files. The function fscanf reads the formatted data into a matrix, by using conversion formats like %s for strings, %d for integers, and %f for floats. The function textscan reads text data from a file and stores it in the cell array. The fgetl and fgets functions both read the strings from a file one line at a time; the dissimilarity is that the fgets holds the newline character when there is one at the end of the line, while the fgetl function gets rid of it. All these functions at first need opening the file, and then closing it when terminated.

As the fgetl and fgets functions read one line at a time, such functions are usually in some form of a loop. The fscanf and textscan functions can read the whole data file into one data structure. In terms of the level, these two functions are somewhat in between the load function & the lower level functions like fgetl. The file should be opened by using fopen first, and must be closed by using fclose afterward the data has been read. Though, no loop is needed; they will read in the whole file automatically but into the data structure.

 

 

Request for Solution File

Ask an Expert for Answer!!
Applications of MATLAB: reading from filesthere are many lower level
Reference No:- TGS0175120

Expected delivery within 24 Hours