Documentation Center

  • Trial Software
  • Product Updates

dsp.MatFileReader class

Package: dsp

Read MAT file

Description

The MatFileReader object reads V7.3 MAT files.

To read V7.3 MAT files:

  1. Define and set up your System object™. See Construction.

  2. Call step to read the MAT file according to the properties of dsp.MatFileReader. The behavior of step is specific to each object in the toolbox.

Construction

H = dsp.MatFileReader returns a System object, H, to read data from a V7.3 MAT file.

H = dsp.MatFileReader('PropertyName',PropertyValue,...) returns a MAT file reader System object, H, with each specified property set to the specified value.

H = dsp.MatFileReader(FILENAME,VARIABLENAME'PropertyName',PropertyValue,...) returns a MAT file reader System object, H, with the Filename property set to FILENAME, the VariableName property set to VARIABLENAME, and other specified properties set to the specified values.

Properties

Filename

Name of MAT file from which to read

Specify the name of a MAT file as a string. Specify the full path for the file only if the file is not on the MATLAB® path. The default file name is Untitled.mat.

VariableName

Name of the variable to read

Name of the variable stored in and read from the MAT file. The default variable name is x.

FrameBasedProcessing

Enable frame-based processing

Set this property to true to enable frame-based processing. Set this property to false to enable sample-based processing. The default is true.

SamplesPerFrame

Number of samples per output frame

Specify the number of elements to read from the MAT file each time the step method is called. This property applies when FrameBaseProcessing is true. The default number of samples per frame is 1.

Methods

cloneCreate MAT file reader object with same property values
isDoneEnd-of-file status
isLockedLocked status (logical) for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset internal states of multimedia file reader to read from beginning of file
stepRead data from a variable in the MAT file

Examples

Use dsp.MatFileReader and dsp.MatFileWriter to stream data.

filename = [tempname '.mat'];  % Create variable name
 
originalData = rand(40,2);
save(filename,'originalData','-v7.3'); % Write to MAT file
 
H = dsp.MatFileReader(filename,'VariableName',...
   'originalData','SamplesPerFrame', 4);  
while ~isDone(H)         % Stream data into MATLAB
    finalData = step(H);
end

See Also

Was this topic helpful?