How to trace the effect of a change in one function in a program on another function in the same program?
2 ビュー (過去 30 日間)
古いコメントを表示
The general structure of my program is a fairly simple one:
main program
function1(x,y,z);
function2(x1,y1,z1);
functionN(xN,yN,zN);
main program ends
Now if I change something in function1 code, how can I trace the effect of that change in the other functions that get affected.
Thanks.
3 件のコメント
Walter Roberson
2011 年 2 月 24 日
For example, are you using global variables? Sharing data through some mechanism? Or is the structure actually different than that shown, with some of the routines having outputs that become inputs to other routines?
採用された回答
Walter Roberson
2011 年 2 月 28 日
No, computing theory indicates that given the Matlab instruction set, it is not possible to analyze with certainty which variables are or are not affected by a change to another variable.
In practice, substituting something like {} in place of a numeric value will likely catch the next place the value is referenced. By inserting such assignments at strategic places one can systematically trace blocks of code affected by a variable.
Usually, though, it is much easier to use the editor's string search to look for instances of the variable name; if necessary, split the editor pane so you can compare argument lists of a function call to that of the called function so that you know the name given to the variable in the new routine.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Scope Variables and Generate Names についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!