Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

dsp.MatFileReader System object

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.

    Note:   Starting in R2016b, instead of using the step method to perform the operation defined by the System object, you can call the object with arguments, as if it were a function. For example, y = step(obj) and y = obj() perform equivalent operations.

Construction

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

H = dsp.MatFileReader(FILENAME,VARIABLENAME,FRAMESIZE) reads frames of MAT file data, using the specified file name, variable name, and frame size.

H = dsp.MatFileReader('PropertyName',PropertyValue,...) reads MAT file data with each specified property set to the specified value.

H = dsp.MatFileReader(FILENAME,VARIABLENAME,FRAMESIZE,'PropertyName',PropertyValue,...) reads frames of MAT file data, using the specified file name, variable name, and frame size, 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 character vector. Specify the full path for the file only if the file is not on the MATLAB® path.

Default: Untitled.mat

VariableName

Name of the variable to read

Name of the variable stored in and read from the MAT file.

Default: x

SamplesPerFrame

Number of samples per output frame

Specify the number of elements (samples per frame) to read from the MAT file each time the step method is called.

Default: 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 = H();
end
Was this topic helpful?