Storing workspace variables that match the specified regular expressions.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Derrell Dsouza
am 7 Jun. 2022
Kommentiert: Stephen23
am 7 Jun. 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 Kommentar
Stephen23
am 7 Jun. 2022
"It throws an error"
Note that storing meta-data in variable names makes code slow, complex, inefficient, buggy, and difficult to debug.
Akzeptierte Antwort
Fangjun Jiang
am 7 Jun. 2022
Bearbeitet: Fangjun Jiang
am 7 Jun. 2022
see "doc whos"
s=whos('-regexp','^ex_[1]*|^i.\d+')
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Type Identification finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!