Load( ) - Load data from MAT-file into workspace
The variables in the workspace are saved by default as matlab.mat
file. The load command loads these variables to the workspace. If the variables
are stored in a specific file, use the syntax:
S = load(‘Filename’).
The command loads the variables from a Filename.mat file into a
structure array named S. If the file is not .mat file, it will be considered as
an ASCII file and load data into a double-precision array. ASCII files must
contain a rectangular table of numbers, with an equal number...
Saturday, June 25, 2016
Saturday, June 11, 2016
Working with Files in MATLAB - Part 3

fwrite( ) - Write binary data to file
fwrite function is used to write the elements of matrix A to the specified file. The data are written in column order. After write action the pointer will be set to the end of the file.
Count = fwrite(FID, A, ’precision’) format the elements of matrix A to the specified data type defined by precision and write to the file specified by FID.
The optional argument ‘precision’ is similar to the fread function....
Saturday, June 4, 2016
Working with Files in MATLAB - Part 4
fseek( ) - Set file position indicator
fseek is the function used to set the position indicator to the byte with the specified Offset relative to the given Origin.
S = fseek(FID, Offset, Origin) relocate the file position pointer in the file associated with the given FID.
Offset value may be positive or negative integers. If the value is positive the pointer will be moved after the Origin and if the value is negative the pointer will be mover before the Origin.
Origin may be starting of the file ('bof' or -1), end of the file ('eof' or 1)...
Working with Files in MATLAB- Part 2

In the last post we discussed how open and close the external files by MATLAB. In this post we will discuss some low level read and write functions to work with external files. Read Part 1 Here.
Low level I/O functions are used to read or write data to a file. It gives more control over the I/O operation if you have the full details of the file. The file must be opened before using these commands.
fscanf( ) - Read formatted data from a text file
fscanf...
Subscribe to:
Posts (Atom)