Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this 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

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

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

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

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

isDoneEnd-of-file status
resetReset internal states of multimedia file reader to read from beginning of file
stepRead data from a variable in the MAT file
Common to All System Objects
clone

Create System object with same property values

getNumInputs

Expected number of inputs to a System object

getNumOutputs

Expected number of outputs of a System object

isLocked

Check locked states of a System object (logical)

release

Allow System object property value changes

Examples

expand all

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

Read a MAT file using the MatFileReader object.

filename = [tempname '.mat'];  % Create variable name
originalData = rand(40,2);
save(filename,'originalData','-v7.3'); % Write to MAT file

mfr = dsp.MatFileReader(filename,'VariableName',...
   'originalData','SamplesPerFrame', 4);
while ~isDone(mfr)         % Stream data into MATLAB
    finalData = mfr();
end
Was this topic helpful?