Main Content



Determine whether datastore is shuffleable

Since R2020a



tf = isShuffleable(ds) returns logical 1 (true) if the datastore ds is shuffleable. Otherwise, the result is logical 0 (false).

You can use the shuffle function on shuffleable datastores to randomize the ordering of files, while preserving the row associations of files in different datastores.

Input Arguments

expand all

Input datastore. You can use these datastores as input:

  • MATLAB® datastores — Datastores created using MATLAB datastore functions. For a complete list of datastores, see Select Datastore for File Format or Application.

  • Combined and transformed datastores — Datastores created using the combine and transform functions.

  • Custom datastores — Datastores created using the custom datastore framework. Any datastore that subclasses from supports the isShuffleable function. See Develop Custom Datastore for more information.


expand all

This example shows how to determine the shuffleability of a object that contains big data from a simulation.

Log Big Data from Model

Open the example model sldemo_fuelsys.


Select Configuration Parameters > Data Import/Export > Log Dataset data to file.


Simulate the model.


The MAT-file out.mat appears in your current folder. The file contains data for logged signals such as fuel (which is at the root level of the model).

At the command prompt, create a DatasetRef object that refers to the logging variable by name, sldemo_fuelsys_output.

DSRef = Simulink.SimulationData.DatasetRef('out.mat','sldemo_fuelsys_output');

Preview Big Data

Use curly braces ({ and }) to extract the signal element fuel, which is the tenth element in DSRef, as a Simulink.SimulationData.Signal object that contains a SimulationDatastore object.

SimDataSig = DSRef{10};

To more easily interact with the SimulationDatastore object that resides in the Values property of the Signal object, store a handle in a variable named DStore.

DStore = SimDataSig.Values;

Determine if the datastore is shuffleable.

if isShuffleable(DStore)
    disp('Datastore is shuffleable.')
    disp('Datatstore is not shuffleable.')
Datatstore is not shuffleable.

Version History

Introduced in R2020a