How to inspect local variables of a function

4 次查看(过去 30 天)
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?
  2 个评论
José-Luis
José-Luis 2012-9-21
Well, you could just return the variables you are interested in... Or am I missing something?
Moshe
Moshe 2012-9-21
I want to debug the code, so I'd like to quickly inspect all the variables, and how they change with the parameters, to see what is going on. I am looking for a minimal solution to do so, without creating loads of temporary objects.

请先登录,再进行评论。

采纳的回答

José-Luis
José-Luis 2012-9-21
Use breakpoints either in your script and/or in your function.

更多回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2012-9-21
编辑:Azzi Abdelmalek 2012-9-21
declare them global in both your function and matlab command
global var1 var2 var3

类别

Help CenterFile Exchange 中查找有关 Variables 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by