Main Content

isShuffleable

Determine whether datastore is shuffleable

Since R2020a

Description

tf = isShuffleable(dst) returns logical 1 (true) if the datastore dst is shuffleable and logical 0 (false) otherwise.

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.

example

Examples

collapse all

When you have a matlab.io.datastore.SimulationDatastore object that contains big data from a simulation, you can determine the shuffleability of the SimulationDatastore using the isShuffleable function.

Log Big Data from Model

Open the example model sldemo_fuelsys.

mdl = "sldemo_fuelsys";
open_system(mdl)

Select Configuration Parameters > Data Import/Export > Log Dataset data to file. Alternatively, you can use the set_param function to log simulation data logged using the Dataset format to a MAT-file instead of the workspace.

set_param(mdl,"LoggingToFile","on")

Simulate the model.

sim(mdl)

The MAT-file out.mat appears in your current folder. Logged signal data is stored in the MAT-file with the variable name sldemo_fuelsys_out.

Create a DatasetRef object that refers to the logged signal data.

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

Preview Big Data

Use curly braces to extract the signal named fuel, which is the tenth element in DSRef, as a Simulink.SimulationData.Signal object. The SimulationDatastore object exists in the Values property of the returned Signal object named SimDataSig.

SimDataSig = DSRef{10};
DStore = SimDataSig.Values;

Determine whether the datastore is shuffleable.

if isShuffleable(DStore)
    disp("Datastore is shuffleable.")
else
    disp("Datatstore is not shuffleable.")
end
Datatstore is not shuffleable.

Input Arguments

collapse 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 matlab.io.Datastore supports the isShuffleable function. See Develop Custom Datastore for more information.

Version History

Introduced in R2020a