Conversion to double from cell is not possibel

1 Ansicht (letzte 30 Tage)
Seum Bin Rahman
Seum Bin Rahman am 7 Sep. 2019
Kommentiert: Seum Bin Rahman am 7 Sep. 2019
for j=1:1:P
reference=pointlist{j,1}
A = raw{strcmp(data,reference),2};
B = raw{strcmp(data,reference),5};
C = raw{strcmp(data,reference),6};
D = raw{strcmp(data,reference),11};
E = raw{strcmp(data,reference),12};
F = raw{strcmp(data,reference),13};
G = raw{strcmp(data,reference),14};
H = raw{strcmp(data,reference),15};
I = raw{strcmp(data,reference),16};
T(j,2:10) = table(A,B,C,D,E,F,G,H,I);
end
The error is; "Conversion to double from cell is not possible."
At this line T(j,2:10) = table(A,B,C,D,E,F,G,H,I);

Antworten (1)

Guillaume
Guillaume am 7 Sep. 2019
Whatever T is, it's very likely that:
T(j, 2:10) = a_table
is going to be an error.
Now, I wouldn't expect that line to throw the error you get if table is the table function, Perhaps, you've created your own table function or have a variable called table.
I'm not sure what your line is supposed to do, but it doesn't make sense.
Note that assuming you are indeed created tables, then:
for j = 1:numel(pointlist) %assuming that size(pointlist) is [P, 1]
reference = pointlist{j};
something = cell2table(raw(strcmp(data, reference), [2, 5, 6, 11:16])); %convert columns 2, 5, 6, 11:16 of raw to table for the rows that match
%... possibly more code
end
would be a lot simpler. Sequentially named variables are almost always an error.
I've no idea what something is supposed to be since you haven't explained what your code is meant to do.
  1 Kommentar
Seum Bin Rahman
Seum Bin Rahman am 7 Sep. 2019
yes, table() is meant for table. Can you help me to write the table function? at each etaration, it will add new row

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by