I am new to MATLAB and would like to extract data from a cell array that I got from my database:
sensors =
[ 1] [23] [1] [ 0] [0.1000] [1x29 char]
[ 2] [23] [1] [120] [0.1000] [1x43 char]
[ 3] [23] [1] [120] [0.1000] [1x42 char]
[ 4] [23] [1] [ 15] [0.1000] 'Air Temp Grey Box'
[ 5] [23] [1] [120] [0.1000] [1x34 char]
[ 6] [23] [1] [120] [0.1000] [1x33 char]
[ 7] [23] [1] [120] [0.1000] 'Pool Water Temp'
[ 8] [23] [2] [ 0] [0.1000] [1x28 char]
[ 9] [23] [1] [ 30] [0.1000] [1x22 char]
[10] [23] [1] [ 30] [0.1000] [1x22 char]
[11] [23] [1] [ 30] [0.1000] [1x21 char]
[12] [23] [1] [ 15] [0.1000] [1x20 char]
[13] [23] [1] [ 15] [0.1000] [1x23 char]
[14] [23] [1] [ 30] [0.1000] [1x22 char]
[15] [23] [1] [ 15] [0.1000] 'Ground Air '
[16] [23] [1] [ 5] [0.1000] 'Boiler Cold Water'
[17] [23] [1] [ 5] [0.1000] 'Boiler Hot Water'
[18] [23] [1] [ 5] [0.1000] 'Boiler CH Flow'
[19] [23] [1] [ 5] [0.1000] 'Boiler CH Return'
Now I would like to grab the first column, i.e. the numbers 1 to 19 as well as the respective names in the last column and use them in a for loop, e.g.:
for ID=xxxx
str = num2str(ID);
SQLcommand = strcat('SELECT FROM data where ID=',str);
answer = database.exec(SQLcommand);
......
end
I have tried several different attempts but never succeeded in getting just one of the elements.
Help is appreciated :), thanks in advance. axon