"I have ... a list"
MATLAB does not have a "list" data type. What you show is called a cell array:
https://www.mathworks.com/help/matlab/cell-arrays.html
https://www.mathworks.com/help/matlab/data-types_data-types.html
"I have ... a list"
MATLAB does not have a "list" data type. What you show is called a cell array:
https://www.mathworks.com/help/matlab/cell-arrays.html
https://www.mathworks.com/help/matlab/data-types_data-types.html
Do NOT use eval for trivial code like this. The MATLAB documentation specifically recommends against doing what this answer shows: "A frequent use of the eval function is to create sets of variables such as A1, A2, ..., An, but this approach does not use the array processing power of MATLAB and is not recommended. The preferred method is to store related data in a single array."
Source: https://www.mathworks.com/help/matlab/matlab_prog/string-evaluation.html
Using eval is how beginners force themselves into writing slow, complex, buggy code that is hard to debug. Read more here:
See my answer for a simple solution that avoids these problems entirely.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!