Is it possible to organize variables shown in workspace?
11 ビュー (過去 30 日間)
古いコメントを表示
I am interested to arrange parameters shown in the workspace based on the script. I have two scripts now and one script calls the other one. At the end of simulation variables of two scripts are shown in workspace alphabetically. Is it possible to sort them by script so that the variables of script one are shown first and then the variables of script two?
0 件のコメント
回答 (1 件)
Stephen23
2019 年 9 月 5 日
編集済み: Stephen23
2019 年 9 月 5 日
"At the end of simulation are variables of two scripts are shown in workspace alphabetically. Is it possible to sort them by script?"
No.
It doesn't even make sense, because variables in a workspace do not have an "order". How they are displayed is simply an artefact of the displaying functionality of the MATLAB IDE, which is not specified to be in any particular "order", it could also change between different MATLAB versions.
In contrast (and by definition) all arrays do have an order: the 1st array element comes 1st, the 2nd array element comes 2nd, etc.
If you want to sort data into a specific order, you need to use an array (which could be a numeric array, a cell array, a structure array, a table, etc.).
Note that putting meta-data into variable names (which most likely you have) is not recommended. Accessing meta-data in variable names is one way that beginners force themselves into writing slow, complex, obfuscated, buggy code that is hard to debug. Read this to know why:
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!