Storing workspace variables that match the specified regular expressions.
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Derrell Dsouza
il 7 Giu 2022
Commentato: Stephen23
il 7 Giu 2022
How do we store workspace variables identifed using regular expressions.
Consider the following example below...
ex_1 = 5;
ex_2 = 3;
i_i = 4;
%if I do this
whos -regexp ^ex_[1]*|^i.\d+
%it works
%but if I do this
s = whos(-regexp ^ex_[1]*|^i.\d+);
%it throws an error
1 Commento
Stephen23
il 7 Giu 2022
"It throws an error"
Note that storing meta-data in variable names makes code slow, complex, inefficient, buggy, and difficult to debug.
Risposta accettata
Fangjun Jiang
il 7 Giu 2022
Modificato: Fangjun Jiang
il 7 Giu 2022
see "doc whos"
s=whos('-regexp','^ex_[1]*|^i.\d+')
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Get Started with MATLAB 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!