Main Content


Class: Simulink.sdi.DatasetRef
Package: Simulink.sdi

Retrieve element as sdidatastore object


[elementDatastore, name, index] = SDIDatasetRef.getAsDatastore(arg)


[elementDatastore, name, index] = SDIDatasetRef.getAsDatastore(arg) returns the requested element as a, along with the element name and index.

Input Arguments

expand all

Search criterion used to retrieve the element from the Simulink.sdi.DatasetRefobject. For name-based searches, specify arg as a character vector. For index-based searches, arg is an integer, representing the index of the desired element.

Example: 'MySignal'

Example: 3

Output Arguments

expand all

The name of the element.

The index of the element in the Simulink.sdi.DatasetRef object.


expand all

This example shows how to create a sdidatastore object for a signal in a Simulink.sdi.DatasetRef object.

% Simulate model sldemo_fuelsys to create a run of logged signals

% Get the runID
runIDs = Simulink.sdi.getAllRunIDs;
runID = runIDs(end);

% Get the run object
fuelRun = Simulink.sdi.getRun(runID);

% Make a Simulink.sdi.DatasetRef object
run_DSRef = fuelRun.getDatasetRef;

% Get the names of the elements in the object
names = run_DSRef.getElementNames
names = 16x1 cell
    {'CheckRange'                   }
    {'air_fuel_ratio'               }
    {'speed'                        }
    {'map'                          }
    {'ego'                          }
    {'throttle'                     }
    {'fuel'                         }
    {'EGO Fault Switch:1'           }
    {'Engine Speed Fault Switch:1'  }
    {'MAP Fault Switch:1'           }
    {'Throttle Angle Fault Switch:1'}
    {'ego_sw'                       }
    {'engine_speed'                 }
    {'speed_sw'                     }
    {'map_sw'                       }
    {'throttle_sw'                  }

% Get sdidatastore object for fuel signal
fuel_ds = run_DSRef.getAsDatastore(10);


You can construct a sdidatastore object for a specified signal using

Version History

Introduced in R2017b