Contenuto principale

addForMATLAB

R2026b

Add an instrument to a target object for MATLAB data

Since R2026a

Description

addForMATLAB(target_object.Instruments,instrument_object) adds an instrument to a Target object for MATLAB® data.

example

Examples

collapse all

When you add instruments to Target objects for data in MATLAB, the signal data from the instruments is added for MATLAB access from the real-time application. If you create an instrument for streaming data to an app (for example, by using connectScalar and connectLine), you add the instrument with this method, and the app updates automatically. You do not need to see or access the data in MATLAB. If you want to access the data directly in MATLAB (for example, you want to write the data to an app yourself), you create a callback on the Instrument object. From the callback method, you can access the data. If you do not add a callback, you are not able to access the data directly.

  1. Create target object and connect to target computer. Open model and configure model for target computer. Build model.

    tg = slrealtime;
    connect(tg);
    model = 'slrt_ex_osc';
    openExample(model);
    modelSTF = getSTFName(tg);
    set_param(model,"SystemTargetFile",modelSTF);
    slbuild(model);
  2. Create instrument object and add signal from real-time application.

    tgInst = slrealtime.Instrument(model);
    addSignal(tgInst,'SigGen');
  3. Add an instrument to the Target object for MATLAB data.

    addForMATLAB(tg.Instruments,tgInst);

Input Arguments

collapse all

To create the instrument object, use the Instrument function.

Example: hInst

Object that represents target computer, specified as a Target object. The object provides access to methods that manipulate the target computer properties.

Example: tg

Version History

Introduced in R2026a