Use a single variable name/label with the dot notation, to get access to a table content
Hi, I have a table called "mydata"
>> class(mydata)
ans = ‘table’
from which I usually retreive data (stored in its columns) throught the following dot notation command:
mydata.BLUE
mydata.GREEN
mydata.WHITE
…
This time, I would like to use a single "table variable name/label" which contains all the "columns names"
label = {‘BLUE’,’GREEN’,’WHITE’}
in order to get access to all the data I need. Something like this, that obviously does not work:
for i = 1 : 3
mydata.label(i)
end
Any suggestion?
P.S.: I am not sure if I used the correct matlab terminology to explain my question and for the corresponding title. If both title and question are not clear, I will change them.Hi, I have a table called "mydata"
>> class(mydata)
ans = ‘table’
from which I usually retreive data (stored in its columns) throught the following dot notation command:
mydata.BLUE
mydata.GREEN
mydata.WHITE
…
This time, I would like to use a single "table variable name/label" which contains all the "columns names"
label = {‘BLUE’,’GREEN’,’WHITE’}
in order to get access to all the data I need. Something like this, that obviously does not work:
for i = 1 : 3
mydata.label(i)
end
Any suggestion?
P.S.: I am not sure if I used the correct matlab terminology to explain my question and for the corresponding title. If both title and question are not clear, I will change them. Hi, I have a table called "mydata"
>> class(mydata)
ans = ‘table’
from which I usually retreive data (stored in its columns) throught the following dot notation command:
mydata.BLUE
mydata.GREEN
mydata.WHITE
…
This time, I would like to use a single "table variable name/label" which contains all the "columns names"
label = {‘BLUE’,’GREEN’,’WHITE’}
in order to get access to all the data I need. Something like this, that obviously does not work:
for i = 1 : 3
mydata.label(i)
end
Any suggestion?
P.S.: I am not sure if I used the correct matlab terminology to explain my question and for the corresponding title. If both title and question are not clear, I will change them. dot notation, table MATLAB Answers — New Questions