Fopen function - file function, MATLAB in Statistics

fopen function - file function:

The fopen opens the file for reading. The fscanf then reads each line one double and one character, and put each pair in individual columns in the matrix. The dimensions identify that the matrix has two rows, by though many columns are essential (equivalent to the number of lines in the file). As matrices store the values which are all of similar type, the characters are stored as their ASCII equivalents in the character encoding (example, 'a' is 97). This matrix has been once created; it may be more helpful to separate the rows into vector variables and to convert the second back to characters, that can be completed as shown below:

>> nums = mat(1,:);

>> charcodes = char(mat(2,:))

charcodes =

abaab

 

Obviously, the results from fopen and fclose must be checked but were absent here for the simplicity.

Posted Date: 10/20/2012 6:25:30 AM | Location : United States







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

Write discussion on Fopen function - file function
Your posts are moderated
Related Questions
Example of Vectorizing: Likewise, for an operation on a matrix, a nested loop would be needed; for illustration, supposing a matrix variable mat: [r c] = size(mat); 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

Nested for Loops: The action of a loop can be any of the valid statement(s). Whenever the action of a loop is the other loop, this is known as nested loop. As an illustrati

Curve Fitting: The data is fundamentally either discrete or continuous. In most of the applications, data is sampled, for illustration, The temperature recorded every ho

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

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

Example of Mode When no value appears more often than any other, the smallest value in the vector will be the mode of the vector. >> shortx = [2 5 1 4]; >> mode(shortx

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

Vectors of nested structures: The Combining vectors and nested structures are possible to have a vector of structures in which several fields are structures themselves. Here i

Help function: Function is computing the two values, there are two output arguments in the function header (i.e., area & circum), that are placed in the square brackets [ ]. A