Main Content

progress

R2026b

Return percentage of data read from datastore

Description

p = progress(dst) returns the percentage of the data read from the datastore object dst. The percentage is returned as a number between 0 and 1. For example, a return value of 0.55 means that you have read 55% of the data. Use the progress function and the NumSamples property to determine the current read position.

example

Examples

collapse all

Create a DatasetRef object that refers to the logged output data of the MAT file out.mat.

DSRef = Simulink.SimulationData.DatasetRef("out.mat","yout");

The SimulationDatastore object is stored in the Values property of the returned Signal object. Get the SimulationDatastore object for the second element in the DatasetRef object.

simDSSig = DSRef{2};
dStore = simDSSig.Values;

Set the ReadSize property of dstore to 200 and read from dstore 10 times. Each read operation advances the reading position by 200 samples.

dStore.ReadSize = 200;
for idx = 1:10
    read(dStore);
end

Find the percentage of the datastore that has been read.

percentComplete = progress(dStore)
percentComplete = 0.2000

Input Arguments

collapse all

Input datastore, specified as a matlab.io.datastore.SimulationDatastore object or matlab.io.datastore.MLDATXSignalDatastore object.

Output Arguments

collapse all

Percentage of data read from the datastore, returned as a number between 0 and 1.

Data Types: double

Version History

Introduced in R2017a