Main Content

set

Assign Instrument object property values

Since R2026a

Description

set(instrument_object,propertyName = propertyValue) sets a property value for a specified property name in the Instrument object.

set(instrument_object,propertyNames,propertyValues) sets property values for specified property names in the Instrument object.

set(instrument_object,propertyNamesValues) uses the propertyNamesValues structure to set the property values for properties in the Instrument object.

propertyStruct = set(instrument_object) creates a propertyStruct structure with the settable property names from the Instrument object. The values are empty in the structure. There read-only-after-written properties (Application and ModelName) are omitted from the structure.

For more information about Instrument object properties, see Instrument.

example

Examples

collapse all

Use the set function to change property values in an Instrument object.

  1. Create target object and connect to target computer. Open model and configure model for target computer. Build model. Create instrument object and add signal from real-time application.

    objTarg = slrealtime;
    connect(objTarg);
    model = 'slrt_ex_osc';
    openExample(model);
    modelSTF = getSTFName(objTarg);
    set_param(model,"SystemTargetFile",modelSTF);
    slbuild(model);
    mldatxname = 'slrt_ex_osc.mldatx';
    objInst = slrealtime.Instrument(mldatxname);
    addSignal(objInst,'SigGen');
  2. Set the Name property value for the Instrument object.

    set(objInst,'Name' = 'Oscillator');
  3. Set property values for the Instrument object by using cell arrays of property names and value.

    propertyNamesOsc = ...
        {'Enable','Name','AxesTimeSpan','AxesTimeSpanOverrun'};
    propertyValuesOsc = ...
        {true,'Oscillator',Inf,'scroll'};
    set(objInst,propertyNamesOsc,propertyValuesOsc);

Input Arguments

collapse all

To create the instrument object, use the Instrument function.

Example: hInst

The names of Instrument object properties.

Example: myPropertyName

A value of an Instrument object property.

Example: myPropertyValue

The names of Instrument object properties.

Example: myPropertyNames

The values of Instrument object properties.

Example: myPropertyValues

The names and values of Instrument object properties.

Example: myPropertyNamesAndValues

Output Arguments

collapse all

A structure of Instrument object properties and value.

Example: myPropertyValue

The values of Instrument object properties.

Example: myPropertyValues

Version History

Introduced in R2026a