Reading from a file, MATLAB Programming

Reading from a File:

A file has been once created; it can be read into a matrix variable. When the file is a data file, the load function will read from the file filename.ext (example, the extension may be .dat) and generate a matrix with similar name as the file. For illustration, if the data file testfile.dat had been generated, this would read from it:

>> clear

>> load testfile.dat

>> who

Your variables are:

testfile

>> testfile

testfile =

Note: The load command works only if there are similar numbers of values in each line, so that the data can be stored in a matrix and the save command only writes from the matrix to a file. If this is not the situation, the lower-level file I/O functions should be used.

 

Posted Date: 10/18/2012 7:09:29 AM | Location : United States







Related Discussions:- Reading from a file, Assignment Help, Ask Question on Reading from a file, Get Answer, Expert's Help, Reading from a file Discussions

Write discussion on Reading from a file
Your posts are moderated
Related Questions
how do I make a second main function?

Complete assignment as per attached word doc. Include function files along with Matlab assignment file.

Functions with Local Variables: The functions we have seen faraway have been very easy. Though, in many situations the computations in a function are more complex, and may nee

Illustration of Variable number of input arguments: In this situation, it was supposed that the radius will always be passed to the function. The function header can hence be

Illustration of Modifying Elements: Illustration, the fifth element in the vector newvec is 9 >> newvec(5) ans = 9 The subset of a vector, that would be a vector it

can you please help me with matlab coding for CMP? I am new to matlab and hence need help

Illustration of modifying the matrix elements: If a single index is used with the matrix, the MATLAB unwinds the matrix column by column. For illustration, for the matrix intm

Expressions: The Expressions can be formed using values, variables which have already been formed, operators, parentheses, and built-in functions. For numbers, these can invol


The Format Function and ellipsis: The default in MATLAB is to show numbers which have decimal places with four decimal places. The format command can be used to identify the o