find_vehicledata = Simulink.findVars('sf_car','Name','vehicledata')
find_vehicledata =
Simulink.WorkspaceVar handle
Package: Simulink
Properties:
Name: 'vehicledata'
Workspace: 'sf_car'
WorkspaceType: 'model'
UsedByBlocks: {'sf_car/Vehicle'}
The Properties section of the above output shows that the model uses the variable vehicledata, it is used by the block sf_car/Vehicle, and stored in the model workspace (see the WorkspaceType property). This is why if you try to change the variable vehicledata in the base workspace, it has no effect. Also, note that the return object find_vehicledata is of type Simulink.WorkspaceVar.

Another scenario is when you have many variables in your MATLAB base workspace and you want to know which ones you need to simulate a model. Instead of using the Name property this time, you can use the WorkspaceType property as follows:
base_vars = Simulink.findVars('sf_car','WorkspaceType','base')
base_vars =
0x0 empty Simulink.WorkspaceVar handle
Package: Simulink
Properties:
Name
Workspace
WorkspaceType
UsedByBlocks
This time the return object is empty indicating that the model is not using any of the base workspace variables. I hope that Simulink.findVars provides you a way to manage your workspaces and variables.
Now it's your turn
The Simulink.findVars documentation includes more options and use-cases. Try out Simulink.findVars on your models and let us know what you find with a comment here.

@Parasar, Nice feature.
I don’t have 10a and have only read doc. Would you give some detail on mask workspace? How is findVars return relate to MaskVariables? What happen to MaskInitialization (which can fail) created variables, esp. with cached find?
Workspace is important subject. Please explain cases for nested maskspace, linked library, and reference model.
@Wei
Glad you liked the feature. You can apply the Simulink.findVars for Mask workspaces too. Variables declared under Mask Initialization can be found as long as they are used as block parameters for any of the blocks inside the masked subsystem.
Nested Masks: I am not sure what you would like to do with mask workspaces that are nested. Please note that once you get the Simulink.WorkspaceVar objects (here for the mask workspaces) you can use methods like intersect and setdiff to compare the workspaces.
Reference Model: Simulink.findVars can find base workspace variables used that are used in child models. However Simulink.findVars only sees the model workspace of the parent model. You can obtain the model workspaces of individual child reference models by specifying the model name separately.
Hope this helps
Parasar
The Simulink.findVars is not working for me
matlab returns an error
??? Undefined variable “Simulink” or class “Simulink.findVars”.
i tried this in the matlab command window and got this error and am using R2007b
@Naresh, Simulink.findVars is a new feature introduced in MATLAB R2010a. With a license under maintenance, you can update your installation in the suppoert section of the website.
There are some of variable in the SIMULINK demo which I don’t know their values. Could you please explain me how I can find their initial values?
@Mousa Marzband – If you look at the workspace returned in the Simulink.WorkspaceVar object, you can determine where the variable is. Then you can evaluate it. This is explained in the documentation for Simulink.WorkspaceVar.
For example, if the variable ‘x’ is in the ‘base’ workspace, you can call:
>> x or >> evalin('base','x')If the variabel is in the model workspace, I reccomend looking into the model explorer. This way you can see the variable in the model workspace. If you need to do it programatically, the documentation on Using MATLAB Commands to Change Workspace Data illustrates how to do this.
Finally, there are some variables burried in blocks in the mode and it takes a little work to see them. The Mask workspace isn’t accessible through those methods. You can use a get_param command to see the MaskWSVariables:
I hope this helps!