Conversion to double from cell is not possibel

조회 수: 2 (최근 30일)
Seum Bin Rahman
Seum Bin Rahman 2019년 9월 7일
댓글: Seum Bin Rahman 2019년 9월 7일
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