removeProperty - Remove property from Simulink.SimulationOutput
object - MATLAB ([original](https://www.mathworks.com/help/simulink/slref/simulink.simulationoutput.removeproperty.html)) ([raw](?raw))
Main Content
Remove property from Simulink.SimulationOutput
object
Syntax
Description
[simOut](#mw%5F65f18077-e48d-4739-9335-4845f397a359) = removeProperty([simOut](#mw%5F65f18077-e48d-4739-9335-4845f397a359),[prop](#mw%5F6a4aad5f-73dc-4763-a730-b0f958bbaaee))
removes one or more properties prop
from theSimulink.SimulationOutput
object simOut
.
You can use the removeProperty
function to remove data logging properties and custom properties from a Simulink.SimulationOutput
object. You cannot use the removeProperty
function to remove read-only properties.
Examples
A Simulink.SimulationOutput
object represents the result of a simulation. The SimulationOutput
object contains simulation metadata and all data logged from simulation. You can modify the contents of a Simulink.SimulationOutput
object by adding or removing data logging and custom properties.
Open the model LoggingBlocks
, which logs several input signals using multiple logging techniques.
- The output of the Sine Wave block is logged using signal logging.
- The output of the Gain block is logged using a To Workspace block.
- The outputs of the Gain, Chirp Signal, and Square Wave Generator blocks are logged using a Record block.
- The output of the Square Wave Generator block is logged using output logging.
The model is also configured to log time data.
mdl = "LoggingBlocks"; open_system(mdl)
Use the get_param
function to save the values of the Amplitude and Frequency parameters of the Sine Wave block. Store the values in the structure sinConfig
.
sinConfig.sinAmp = get_param(strcat(mdl,"/Sine Wave"),"Amplitude"); sinConfig.sinFreq = get_param(strcat(mdl,"/Sine Wave"),"Frequency");
Simulate the model.
The simulation results contain all logging variables created in simulation. Use the who
function to get a list of properties you can modify.
props = 5×1 cell {'logsout' } {'recordout'} {'simout' } {'tout' } {'yout' }
For this simulation, suppose you want to save only the data for the signal path related to the Sine Wave block. Use the removeProperty
function to remove the recordout
and yout
properties.
out = removeProperty(out,["recordout" "yout"]); who(out)
This Simulink.SimulationOutput object contains these editable properties:
logsout simout tout
You can also add data to a Simulink.SimulationOutput
object by adding your own properties to the object or by using the setUserData
function to specify the value of the UserData
property on the Simulink.SimulationMetadata
object.
Suppose you want to save the parameter values for the Sine Wave block as a property on the Simulink.SimulationOutput
object. Add the property SineWaveParameters
by using dot notation the same way you add a field to a structure.
out.SineWaveParameters = sinConfig; who(out)
This Simulink.SimulationOutput object contains these editable properties:
SineWaveParameters logsout simout tout
Input Arguments
Property to remove, specified as a string, a string array, a character vector, or a cell array of character vectors. To delete a single property, specify the name of the property as a string or a character vector. To delete multiple properties, specify the names of the properties as a string array or a cell array of character vectors.
You cannot remove read-only properties, such as theSimulationMetadata
and ErrorMessage
properties, from a Simulink.SimulationOutput
object. To get a list of properties that you can remove, use the who function.
Example: simOut = removeProperty(simOut,"MyProperty")
Data Types: char
| string
Output Arguments
Tips
- Modifying the contents of simulation results in a
Simulink.SimulationOutput
object using a post-simulation function can be useful in parallel computing workflows. For example, you can remove data logging properties and send only a subset of logged data from the worker back to the client. For more information, see setPostSimFcn. - Use the removeElement function to remove logged data from a Simulink.SimulationData.Dataset object.
Version History
Introduced in R2019a