How can i trace back the variable from my workspace?

I have received one application which have 30+ MATLAB functions. With the GUI interface i calculate some values which is in the Workspace. Is there a way i can trace back one variable as to in those 30+ function .m files which function it was calculated in?

4 Comments

I don't know any automated way, but if you have a well-written function, everything will be nice encapsulated and none of the function should dump data in the base workspace, so following the trail back manually should be easy.
So the output of the app is struct with some values. so its data(i).struct.dsp.refv. I need to know where refv was calculated. Can you refer any documentation?
Any documentation should be included in the app itself, if it is not part of Matlab itself.
"the output of the app is struct with some values"
Here are a couple of ideas.
  1. If the value you're searching for is within a field named data.struct.dsp.refv, search your code for which function produces "refv". If that's too vague (ie, there are many functions where that is found), then you could add "dsp.refv" and so on. Hopefully the functions are modular enough that the output isn't affected by many of the functions.
  2. With structure outputs I often include a "readme" field when producing output. This field contains the function name and a time stamp when the data was produced. Here's an example.
data(i).struct.dsp.readme = sprintf('This output produced in MyFunct() function on %s',datestr(now));

Sign in to comment.

Answers (0)

Categories

Products

Release

R2018b

Asked:

ARN
on 2 Dec 2019

Commented:

on 2 Dec 2019

Community Treasure Hunt

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

Start Hunting!