Clear variables from the model workspace of a model
clear(mdlWks)
example
clear(mdlWks) removes all variables from the model workspace represented by the Simulink.ModelWorkspace object mdlWks.
mdlWks
Simulink.ModelWorkspace
collapse all
Open the example model vdp.
vdp
open_system('vdp')
Create a Simulink.ModelWorkspace object that represents the model workspace of vdp.
mdlWks = get_param('vdp','ModelWorkspace');
Create a variable named myVar with value 5.12 in the model workspace.
myVar
5.12
assignin(mdlWks,'myVar',5.12)
Clear all variables from the model workspace, including myVar.
Target model workspace, specified as a Simulink.ModelWorkspace object.