Conversion to double from cell is not possibel

1 次查看(过去 30 天)
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);

回答(1 个)

Guillaume
Guillaume 2019-9-7
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 个评论
Seum Bin Rahman
Seum Bin Rahman 2019-9-7
yes, table() is meant for table. Can you help me to write the table function? at each etaration, it will add new row

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by