How to inspect local variables of a function
Show older comments
I'd like to be able to view the local variables generated during the run of a function. One way is to load them to my workspace by saving them to a file, but that could become cumbersome as the number of temporary files proliferate as I experiment with running the function with different parameters. Is there another way?
Accepted Answer
More Answers (1)
Azzi Abdelmalek
on 21 Sep 2012
Edited: Azzi Abdelmalek
on 21 Sep 2012
declare them global in both your function and matlab command
global var1 var2 var3
3 Comments
José-Luis
on 21 Sep 2012
Globals are evil.
Azzi Abdelmalek
on 21 Sep 2012
I think he just want to debug his code
Sean de Wolski
on 21 Sep 2012
So don't use globals! That's a really bad idea as it will exacerbate whatever problem you're having!
Categories
Find more on Variables 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!