Main Content

reloadData

Reload data signal of root inports of model on target computer

Since R2021a

Description

example

reloadData(target_object.Stimulation, inport, tsName) reloads the data signal from a timeseries object to the specified root inport of the model running on the target computer.

example

reloadData(target_object.Stimulation, playback, loadSource) reloads the data signal from a timeseries object, a Simulink.SimulationData.Dataset object, or pairs of ports and timeseries objects for the specified Playback block in the model running on the target computer.

example

reloadData(target_object.Stimulation, blockPath,{parameter_name,loadSource}) reloads the timeseries data to the specified tunable parameter and a timeseries object for the model running on the target computer.

Examples

collapse all

To load data to an inport, create a time series object.

  1. sampleTime = 0.1; %sample time of the model
    endTime = 10; %end time of the model
    numberOfSamples = endTime * 1/sampleTime + 1;
    timeVector = (0:numberOfSamples) * sampleTime;
    u = timeseries(timeVector*10,timeVector);
  2. Load the object to the inport named first.

    reloadData(tg.Stimulation,'first',u);
  3. To load the same object to multiple inports named first and third.

    reloadData(tg.Stimulation,'first',u,'third',u);

To load data to a Playback block, create a time series object.

  1. sampleTime = 0.1; %sample time of the model
    endTime = 10; %end time of the model
    numberOfSamples = endTime * 1/sampleTime + 1;
    timeVector = (0:numberOfSamples) * sampleTime;
    u = timeseries(timeVector*10,timeVector);
  2. Load the object to the Playback block named first.

    reloadData(tg.Stimulation,'first',u);
  3. To load the objects playbackData1 and playbackData2 to a Playback blocks named first and its ports 1 and 2.

    reloadData(tg.Stimulation,'first',{{1,playbackData1},{2,playbackData2}});

To load data to a tunable parameter, create a time series object.

  1. sampleTime = 0.1; %sample time of the model
    endTime = 10; %end time of the model
    numberOfSamples = endTime * 1/sampleTime + 1;
    timeVector = (0:numberOfSamples) * sampleTime;
    u = timeseries(timeVector*10,timeVector);
  2. Load the object to the parameter at block path 'slrt_ex_osc/Signal Generator' and name 'Frequency'. For more information finding the block path for parameters, see Simulink Real-Time Explorer.

    reloadData(tg.Stimulation,'slrt_ex_osc/Signal Generator',{'Frequency',u));

Input Arguments

collapse all

Provides access to methods that manipulate the target computer properties.

Example: tg

Specifies the name of the inport or inport number or block path of the inport present on the model running on the target computer.

Example: {'signal_1'}, [2], {'model_name/in4'}

Specifies a timeseries object to load into the inports.

Example: u

Specifies the name of the Playback block or block path of the Playback block present in the model running on the target computer.

Example: {'signal_1'}, [2], {'model_name/in4'}

Specifies a timeseries object or Simulink.SimulationData.Dataset object to load into the Playback block. Alternatively, specifies pairs of port numbers and timeseries object to load into the Playback block.

Example: {{1,playbackData1},{2,playbackData2}}

The block_path values for tunable parameters in stimulation operations can be:

  • Empty character vector ('') or empty string scalar ("") for base or model workspace variables

  • Character vector or string scalar string for block path to parameters in the top model

  • Cell array of character vectors or string scalars for model block arguments

Example: '', 'Gain1', {'top/model','sub/model'}

The parameter can designate either a block parameter or a global parameter that provides the value for a block parameter. The block parameter or MATLAB® variable must be observable to be accessible through the parameter name.

Note

Simulink® Real-Time™ does not support parameters of multiword data types.

Example: 'Gain', 'oscp.G1', 'oscp', 'G2'

Version History

Introduced in R2021a

expand all