Storing workspace variables that match the specified regular expressions.

8 次查看(过去 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+
Name Size Bytes Class Attributes ex_1 1x1 8 double ex_2 1x1 8 double
%it works
%but if I do this
s = whos(-regexp ^ex_[1]*|^i.\d+);
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
%it throws an error

采纳的回答

Fangjun Jiang
Fangjun Jiang 2022-6-7
编辑:Fangjun Jiang 2022-6-7
see "doc whos"
s=whos('-regexp','^ex_[1]*|^i.\d+')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Identification 的更多信息

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by