'how to use iteration variable in variable name - Matlab [duplicate]
I have a struct res with the variables: det1, det2, det3.
I also have the amount of these variables (in this case 3), and I want to read them in a loop.
How can I integrate the iteration variable in the name of the variables in the loop and read them?
I want to do something like this:
for i=1:num_variables
var_name = 'res.det'+num2str(i);
% read var_name
end
Thanks for the help!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
