Main Content

setUserString

Store custom character vector in SimulationMetadata object in SimulationOutput object

Syntax

simoutNew = setUserString(simout, CustomString)
simoutNew = simout.setUserString(CustomString)

Description

simoutNew = setUserString(simout, CustomString) assigns a copy of Simulink.SimulationOutput to simoutNew. The copy contains CustomString in its SimulationMetadata object.

simoutNew = simout.setUserString(CustomString) is a syntax with dot notation to assign the modified copy of Simulink.SimulationOutput to simoutNew.

Input Arguments

expand all

Simulation output in which to set custom string.

Any custom character vector you want to store in the metadata object.

Output Arguments

expand all

A copy of the simout SimulationOutput object that contains CustomString in its SimulationMetadata object, returned as an object.

Examples

expand all

Simulate the vdp model. Store a custom character vector in the SimulationMetadata object that the SimulationOutput object contains.

Simulate the vdp model. Save the results of the Simulink.SimulationOutput object in simout.

 open_system('vdp')
 simout=sim(bdroot,'ReturnWorkspaceOutputs','on');

Store a character vector to describe the simulation.

simout=simout.setUserString('First Simulation');

Use SimulationOutput.getSimulationMetadata to retrieve the information you stored.

mData=simout.getSimulationMetadata();
disp(mData.UserString)
First Simulation