clear

Clear variables from the model workspace of a model

Description

example

clear(mdlWks) removes all variables from the model workspace represented by the Simulink.ModelWorkspace object mdlWks.

Examples

collapse all

Open the example model 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.

assignin(mdlWks,'myVar',5.12)

Clear all variables from the model workspace, including myVar.

clear(mdlWks)

Input Arguments

collapse all

Target model workspace, specified as a Simulink.ModelWorkspace object.

Introduced before R2006a