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

Mode The mode of a data set is the value which appears most often. The built-in function in a MATLAB for this is known as the mode. >> x = [9 10 10 9 8 7 3 10 9 8 5 10];

Function polyval - interpolation: The function polyval can then be used to compute the polynomial at particular values. For illustration, we could compute at every value in th

Example of Functions which complete a task: For illustration, the function below just prints the number arguments passed to it in a sentence format: As this function i

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

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

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

Tracing: Sometimes, when a program has loops and/or selection statements and is not running properly, it is helpful in the debugging process to know exactly which statements h

Example of customizing plots: As the other illustration of customizing plots, the pieces of a pie chart can be "exploded" from the rest. In this situation, the two vectors are

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