Advanced file input and output, MATLAB in Statistics

Advanced File Input and Output:

In that section, we saw how to read the values entered by user using the input as well as the output functions disp and fprintf, that shows information in windows on the screen. For file input and output (file I/O), we used the load and save the functions, that can read from a data file into the matrix, and write from a matrix to a data file. We also saw that there are three various operations which can be performed on files: reading from files, writing to files (implying writing to the starting of a file), and appending to a file (that is writing to the end of the file).

There are many different file types that use dissimilar filename extensions. Faraway, using load and save, we have worked with files in the ASCII format that usually use either the extension .dat or .txt. The load command works only if there are similar number of values in each line and the values are of similar type, so that the data can be stored in a matrix; the save command writes only from the matrix to a file. When the data to be written or file is to be read in a different format, then the lower level file I/O functions should be used.

The MATLAB software has functions which can read and write data from variousfile types like spreadsheets; usually Excel spreadsheets have the filename extension .xls. It has its own binary file type also that uses the extension .mat.

These are generally known as MAT-files, and can be used to store the variables which have been generated in the MATLAB.


Posted Date: 10/20/2012 6:15:36 AM | Location : United States







Related Discussions:- Advanced file input and output, Assignment Help, Ask Question on Advanced file input and output, Get Answer, Expert's Help, Advanced file input and output Discussions

Write discussion on Advanced file input and output
Your posts are moderated
Related Questions
Illustration of Indexing into vectors of structures: For illustration, the function to print the information from packages has been modified therefore in addition to the vecto

Variable packages: Variable packages are now the vector of structures, hence each and every element in the vector is a structure. To show one element in the vector, an index i

Example of Functions which return values: Calling this function prints the circumference, since there is no way to store the value, hence, it can be used in following computat

Advanced File Input and Output: In that section, we saw how to read the values entered by user using the input as well as the output functions disp and fprintf, that shows inf

Illustration of Mode When there is more than one value with similar (highest) frequency, then the smaller value is mode. In the case below, as 3 and 8 appear twice in the vecto

Areacirc function: The areacirc function can be called from the Command Window as shown here, or from a script. Here is a script which will prompt the user for the radius of o

The IF Statement: The if statement selects whether or not the other statement, or group of statements, is executed. The common form of the if statement is as shown below: i

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

Example of Mode When no value appears more often than any other, the smallest value in the vector will be the mode of the vector. >> shortx = [2 5 1 4]; >> mode(shortx

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