Storing workspace variables that match the specified regular expressions.
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Derrell Dsouza
le 7 Juin 2022
Commenté : Stephen23
le 7 Juin 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 commentaire
Stephen23
le 7 Juin 2022
"It throws an error"
Note that storing meta-data in variable names makes code slow, complex, inefficient, buggy, and difficult to debug.
Réponse acceptée
Fangjun Jiang
le 7 Juin 2022
Modifié(e) : Fangjun Jiang
le 7 Juin 2022
see "doc whos"
s=whos('-regexp','^ex_[1]*|^i.\d+')
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!