Operation on file, MATLAB in Statistics

Operation on file:

We concentrate first on the fgetl function that reads strings from the file one line at a time. The fgetl functions afford more control over how the data is read than the other input functions. The fgetl function reads one line of data from a file into the string; string functions can be used then to manipulate the data. As fgetl reads only one line, it generally is placed in a loop which keeps going until the end of the file is reached. The function feof returns the logical true if the end of the file has been reached. The function call feof(fid) would return the logical true when the end of the file has been reached for the file specified by fid, or logical false when not. A common algorithm for reading from a file into strings would be as shown below:

  •  Try to open the file; check to make sure that the file open was successful.
  •  If opened, the loop until end of the file is reached. For each of line in the file,

-  read it into the string

- manipulate the data

  •  Try to close the file; check to make sure that the file close was successful. 

 

Posted Date: 10/20/2012 6:19:53 AM | Location : United States







Related Discussions:- Operation on file, Assignment Help, Ask Question on Operation on file, Get Answer, Expert's Help, Operation on file Discussions

Write discussion on Operation on file
Your posts are moderated
Related Questions
Nested Functions: We have seen that the loops can be nested, that means that one inside of the other, functions can be nested. The terminology for nested functions is that an

Function polyval - interpolation: The function polyval can then be used to compute the polynomial at particular values. For illustration, we could compute at every value in th

Core Objects: The Core Objects in MATLAB are the very fundamental graphics primitives. The description can be found under the MATLAB Help: Under the Contents tab, click the Ha

Illustration of Indexing: Though, rather than of creating the index vector manually as shown here, the process to initialize the index vector is use to a sort function. The al

Function Stubs: The other common debugging method, which is used when there is a script main program which calls many functions, is to use the function stubs. A function stub

Curve Fitting: The data is fundamentally either discrete or continuous. In most of the applications, data is sampled, for illustration, The temperature recorded every ho

Statistics There are numerous statistical analyses which can be executed on data sets. In MATLAB software, the statistical functions are in the data analysis help topic known a

Vectorizing: In most of the cases in MATLAB, loops are not essential. As MATLAB is written specifically to work with the vectors and matrices, most operations can be completed

Sequential Search: A sequential search is completed by looping through the vector element-by-element starting from the beginning, looking for the key. Usually the index of the

Lower Level File I/O Functions: Whenever reading from data file, as long as the data in the file is "regular" the load function works-in another words, the similar type of dat