Main Content

preview

Read first signal observation from datastore for preview

Description

example

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.

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 = 
'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 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.

Introduced in R2020a