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
#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

Index vector: The index vector is then used as the indices for original vector. To get grades vector in ascending order, the indices used would be grades (2), grades (5), and

Data structure layers: There are many layers in this variable. For illustration,  cyls is the whole data structure, that is a vector of structs  cyls(1) is a separate

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

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

Example of Nested functions: For illustration, the function below computes and returns the volume of a cube. Three arguments are then passed to it, for the width and length of

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

Combining Nested FOR Loops and the IF Statements: The statements inside a nested loop can be any of the valid statement, involving any selection statement. For e.g., there can

Sequential Search: A sequential search is completed by looping through the vector element-by-element starting from the beginning, looking for the key. Usually the index of the