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
Execution of persistent variables: The functions can also be called from the script or from the Command Window, as shown here. For illustration, the functions are called first

Steps for input output functions - Lower level file: The steps involved are as shown below:  Open the file.  Read the file, write to the file, or append to the file.

bjjh

Illustration of reading from files: For illustration, suppose that there is a data file 'subjexp.dat' that has on each line a number followed by thecharacter code. The type fu

Functions which complete a task without returning Values: Most of the functions do not compute values, but instead of accomplish a task like printing formatted output. As thes

Persistent Variables: Generally, whenever a function stops executing, then the local variables from that function are cleared. That means that each and every time a function i

Logical errors: The Logical errors are more complicated to locate, as they do not result in any error message. The logical error is a mistake in reasoning by the programmer, b

fscanf function - file function: The fscanf reads matrix variable mat columnwise from the file specified by fid. The 'format' involves conversion characters much similar to th

Illustration of Customizing plots: Illustration, the bar and barh functions by the default place a width of 0.8 between bars. Whenever called as bar(x,y), the width of 0.8 is

Median The median is defined only for a data set which has been sorted first, that means that the values are in order. The median of a sorted set of data values (n) is defined