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
Input in a While Loop: The script below repeats the procedure of prompting a user, the reading in a positive number, and echo-printing it, as long as the user properly enters

Functions which return Values versus printing: Also, the function which computes and returns values (throughout the output arguments) does not generally print them; that is le

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

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

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

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

Introduction and Purpose In the lectures and tutorials you have been introduced to a number of probability distributions. You have also learned that modelling any system (such

Use of function polyval: The better the curve fit, the more exact these interpolated and extrapolated values will be. By using the subplot function, we can loop to display the

Illustration of Binary search: An illustration to search for the key of 91 in the vector is as shown below: The table below shows what will happen in each iteration of

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