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 tracing a error: The one way of following the flow of function, or tracing it, is to use the echo function. The echo function, that is a toggle, will show each

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

Sorting Strings: For the matrix of strings, the sort function works exactly as formerly for numbers. For illustration, >> words = char('Hi', 'Hello', 'Howdy', 'Goodbye', '

Nested Structures: The nested structure is a structure in which at least one of the members is itself a structure. For illustration, a structure for the line segment may co

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

#qYou will need to examine two of the nine sections of data: one section of qualitative data (choose either Gender or Position) one section of quantitative data (choose either Intr

function sortrows - sorting strings: The function sortrows sorts each and every row as a block, or group, and it also will work on numbers. Here in this illustration the rows

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

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