Main Content

whos

Return list of variables in the model workspace of a model

Description

varList = whos(mdlWks) returns a list of the variables in the model workspace represented by the Simulink.ModelWorkspace object mdlWks.

example

Examples

collapse all

Open the example model vdp.

openExample('simulink_general/VanDerPolOscillatorExample')

Create a Simulink.ModelWorkspace object that represents the model workspace of vdp.

mdlWks = get_param('vdp','ModelWorkspace');

Create some variables in the model workspace.

assignin(mdlWks,'myVar',5.12)
assignin(mdlWks,'myOtherVar',7.22)

Display a list of the variables in the model workspace.

whos(mdlWks)
  Name            Size            Bytes  Class     Attributes

  myOtherVar      1x1                 8  double              
  myVar           1x1                 8  double  

Input Arguments

collapse all

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

Output Arguments

collapse all

List of variables, returned as a nested structure array. For details about the information in the list, see whos.

Alternatives

List the entries in a model workspace by using Simulink.data.DataConnection object function.

mw = Simulink.data.connect("myModel.slx");
mw.a = 7;
mw.f = 10;
who(mw)
2x1 cell array

  {'a'}
  {'f'}

Version History

Introduced before R2006a