How to track data through several scripts and functions?
8 views (last 30 days)
Show older comments
Hi, everyone!
I'm modifying an existing toolbox made by someone else and creating my own version of it. The toolbox is composed of several scripts, functions and data (.xlsx, .mat, .csv).
My new toolbox needs to replicate some of the features but not all.
For example if:
script1
calls
model=function1(data,model,in1);
out=function2(data,model,in2);
and in my new toolbox, the modified version of the script goes as
scriptMod1
modelMod=functionMod1(data,modelMod)
outMod=functionMod2(data,modelMod,in2)
Thus, several things are going on. I'm creating modified versions of the functions, modifying the model structure and editing the number of inputs of the functions.
The main problem I have is how to manage all this complexity. I've created a .prj and using the Dependency analyzer i was able to identify function calls quite easy, but i'm still not able to efficiently track the data inside the "Function calls" through-out the whole toolbox. For instance, I'd really need something like a probe to check on the function calls like this:
Right now I'm doing it by hand but it is really tiring and inefficient, cause some of the functions have more than 300 lines and I've like 5 scritps and 10 functions or so.
If anyone has any thoughts on this problem that'd be great!
Thanks!
3 Comments
Mario Malic
on 22 Jan 2021
Edited: Mario Malic
on 22 Jan 2021
If you have a script that calls all other functions, you can convert it to the function, adding all the output arguments to it that you want to check.
%test script
[out1, out2, out3] = myfun1(in1) % out1, ..., are the variables you want to check in the script
[out1new, out2new, out3new] = myfun2(in1)
You can use isequal or some other functions to check are they the same.
You might want to wait for another opinion, as there might be better ways to do this.
Answers (0)
See Also
Categories
Find more on Calendar 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!