Is it possible to organize variables shown in workspace?
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Stephen23
il 5 Set 2019
Modificato: Stephen23
il 5 Set 2019
"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 Commenti
Vedere anche
Categorie
Scopri di più su Variables in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!