A7x
A7x

Reputation: 543

Seeing variables of other local functions in matlab

I have local functions in my main matlab script for example:

Exercise.m

[output 1, output2] = Function1(input);

... and so on

When I run Exercise.m script. I see only the variables of Exercise.m. But I want to see also the variables of Function1.m file. Therefore I go into Function1.m file and run it. But now I'm getting error "not enough input arguments".

What should I do to see variables of my other functions?

Upvotes: 0

Views: 59

Answers (1)

bla
bla

Reputation: 26069

Several options:

  1. you should learn how to debug and use matlab's debugger.

for example, you can put a breakpoint somewhere at the end of the function, when you'll run the script it will stop at the breakpoint showing you only the local memory of the function. You can then press continue, and exit the function and the rest of the code ill run.

  1. avoid using functions, have one big script (dont)

  2. use global \ persistent variable for only the variables you care about that takes place inside the functions. (not very recommended)

Upvotes: 1

Related Questions