Storing workspace variables that match the specified regular expressions.
7 次查看(过去 30 天)
显示 更早的评论
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 个评论
Stephen23
2022-6-7
"It throws an error"
Note that storing meta-data in variable names makes code slow, complex, inefficient, buggy, and difficult to debug.
采纳的回答
Fangjun Jiang
2022-6-7
编辑:Fangjun Jiang
2022-6-7
see "doc whos"
s=whos('-regexp','^ex_[1]*|^i.\d+')
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Identification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!