- #1
mathia
- 15
- 0
Hi,
I want to select my variable automatically in MATLAB so I used the following commands: (may variable for example are: Mpoint1,Mpoint5,Mpoint14,...)
for i=1:50
if exist (eval(['Mpoint' num2str(i)]));
statements
else
continue
end
end
but it gave me the following error:
Error using exist
The first input to exist must be a string.
Anybody know how can I do that?
Mathia
I want to select my variable automatically in MATLAB so I used the following commands: (may variable for example are: Mpoint1,Mpoint5,Mpoint14,...)
for i=1:50
if exist (eval(['Mpoint' num2str(i)]));
statements
else
continue
end
end
but it gave me the following error:
Error using exist
The first input to exist must be a string.
Anybody know how can I do that?
Mathia