Main Content

preview

Read first signal observation from datastore for preview

Since R2020a

Description

data = preview(sds) always reads the first file from the signal datastore in the case of file data, or the first member in the case of in-memory data. A call to preview does not affect the state of the signal datastore object.

example

Examples

collapse all

Specify the path to four signals included with MATLAB®. Create a signal datastore that points to the specified folder and display the name of the first file.

folder = fullfile(matlabroot,'toolbox','matlab','audiovideo');
sds = signalDatastore(folder);
[~,c] = fileparts(sds.Files(1))
c = 1x1 cell array
    {'chirp'}

Plot the previewed data from the first file of sds.

data = preview(sds);
plot(data)
xlabel('Samples')
ylabel('Signal')

Figure contains an axes object. The axes object with xlabel Samples, ylabel Signal contains an object of type line.

Input Arguments

collapse all

Signal datastore, specified as a signalDatastore object.

Output Arguments

collapse all

First observation from sds, returned as signal data.

Version History

Introduced in R2020a