Fscanf function - file function, MATLAB in Statistics

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 those used in the fprintf function. The dimensions identify the preferred dimensions of mat; if the number of values in the file is not known,  inf is used for the second dimension. For illustration, the below would read in the similar file identified earlier, that has on each line a number, then a space, then a character.

>> fid = fopen('subjexp.dat');

>> mat = fscanf(fid,'%f %c',[2 inf])

mat =

      5.3000 2.2000 3.3000 4.4000 1.1000

     97.0000 98.0000 97.0000 97.0000 98.0000

>> fclose(fid);

 

 

Posted Date: 10/20/2012 6:24:47 AM | Location : United States







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

Write discussion on Fscanf function - file function
Your posts are moderated
Related Questions
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

Editor/Debugger: The MATLAB has numerous useful functions for debugging, and debugging can also be completed through its editor, which is known as the Editor/Debugger. Typi

Types of errors: There are some various kinds of errors which can occur in a program, that fall into the categories of run-time errors, syntax errors, and logical errors. T

Example of Core objects: The one core graphics object is a line that is also what the plot function produces. Here is an illustration of generating a line object, altering som

Illustration of Input in a for loop: In this illustration, the loop variable iv iterates through the values 1 through 3, therefore the action is repeated three times. The acti

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

Illustration of Median When the vector is not in sorted order to start with, the median function will still return the right answer (it will sort the vector automatically). For

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

#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

Roots function - Polynomials: The roots function in MATLAB is used to find the roots of an equation represented by a polynomial. For illustration, for the mathematical functio