Why do some variables not appear in the workspace?
Show older comments
Hi,
I am currently trying to understand how to simulate ground and therefore I had a look at the minigolf example.
My Problem is that there are variables which don't appear in the workspace and I have no idea where else to look for them. Also when I type the name of the variable in the command window it says this variable does not exist.
For example in one "Constant" Block the value is the variable "plane_length". But I can't find it.
Do you know why I can't find it or do you have an idea how I could find out the value behind such variables?
This is the Minigolf Example I am talking about: http://www.mathworks.com/matlabcentral/fileexchange/36541-contact-force-examples-in-simmechanics-mini-golf
I have this problem with the "Contact_Example_1_Wall". It can be found in the folder Contact_Examples.
Would be great if someone could help. This is really bugging me. Kind Regards, P.
Answers (1)
Image Analyst
on 8 Jun 2013
0 votes
Each function has its own workspace, and only the workspace that is in scope will appear in the workspace panel.
4 Comments
Philipp
on 8 Jun 2013
Walter Roberson
on 8 Jun 2013
The workspace of any given function only exists when the function is either executing "now" or called (directly or through a chain of routines) the function that is executing "now". When the function that creates the workspace returns, the workspace is destroyed.
[At least that is the old style of functions. With new style functions (that have an "end" that matches the "function" statement) workspaces might continue to exist as long as there is a "live" reference to a variable in the function or a "live" reference to a nested function of the function. This is unlikely to apply to the example you referenced.]
Philipp
on 10 Jun 2013
Walter Roberson
on 10 Jun 2013
Ah, simulink...
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!