Main Content

setUserData

Store custom data inSimulationMetadataobject thatSimulationOutputobject contains

Syntax

simoutNew = setUserData(simout,CustomData)
simoutNew = simout.setUserData(CustomData)

Description

simoutNew= setUserData(simout,CustomData)assigns a copy ofSimulink.SimulationOutputtosimoutNew. The copy containsCustomDatain itsSimulationMetadataobject.

simoutNew=simout.setUserData(CustomData)is a syntax with dot notation to assign the modified copy ofSimulink.SimulationOutputtosimoutNew.

Input Arguments

expand all

Simulation output in which to modify custom data

Any custom data you want to store in the metadata object.

Output Arguments

expand all

A copy of thesimoutSimulationOutputobject that containsCustomDatain itsSimulationMetadataobject, returned as an object.

Examples

expand all

Simulate thevdpmodel. Store custom data in theSimulationMetadata对象,SimulationOutputobject contains.

Simulate thevdpmodel. Save the results of theSimulink.SimulationOutputobject insimout.

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

Store custom data about the simulation in theSimulationMetadataobject thatsimoutcontains.

simout=simout.setUserData(struct('param1','value1','param2','value2','param3','value3'));

UseSimulationOutput.getSimulationMetadatato retrieve the information you stored.

mData=simout.getSimulationMetadata(); disp(mData.UserData)
param1: 'value1' param2: 'value2' param3: 'value3'