STR2VAR

Returns the variable or array of variables, VAR, matching the pattern STR.

You are now following this Submission

FUNCTION VAR = STR2VAR(STR)

Returns the variable or array of variables, VAR, matching the pattern STR. Matching variables must be of same type.

a = 3;
b = str2var('a'); % b is now equal to a, i.e. 3.

a1 = 3;
a2 = 2;
b = str2var('a*'); % b is now an array with values [3, 2].

Cite As

Thomas (2026). STR2VAR (https://www.mathworks.com/matlabcentral/fileexchange/26341-str2var), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0