Conversion to double from cell is not possibel
조회 수: 2 (최근 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);
댓글 수: 0
답변 (1개)
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!