I am encountering a lot of answers about the evils of dynamicly assigning variable/funciton names, etc. As a new user, I am trying to learn the right way to use MATLAB, and am trying to heed to lessons found in MATLAB answers.
However, at present, I have several structs each named identically but with a numeric at the end and I am working within a limited time frame. I am hoping to be able to assign a string to match the name of the struct and then turn the string into a handle that lets me index into/access values within each of the structs. Is there a simple way about this?
example struct names:
I want to ideally say:
for ii = 1: (10)
sname = ['structData', ii]
% Convert string 'sname' to struct in memory
data_of_interest = sname.fieldname
Usin 'eval' seems like a pain. Is there an easier way? What are structs essentially? What data type would I be converting the string value to in order to access the place in memory where a struct is stored?