필터 지우기
필터 지우기

Error: Conversion to double from cell is not possible

조회 수: 4 (최근 30일)
pamela sulis
pamela sulis 2015년 11월 11일
편집: Stephen23 2015년 11월 11일
Hi! Can you help me to understand why I have this error?
Matrix(5,1)={sum(matchcounts_ab,1) sum(matchcounts_ba,1) sum(matchcounts_AB,1)};
The following error occurred converting from cell to double: Error using double Conversion to double from cell is not possible.
Thanks

답변 (2개)

Thorsten
Thorsten 2015년 11월 11일
편집: Thorsten 2015년 11월 11일
Try
x = {sum(matchcounts_ab,1) sum(matchcounts_ba,1) sum(matchcounts_AB,1)}
whos x
whos M
You try to assign a cell to matrix of doubles.
Use
Matrix{5,1} = {sum(matchcounts_ab,1) sum(matchcounts_ba,1) sum(matchcounts_AB,1)};
and change all others assignments to Matrix accordingly.

Stephen23
Stephen23 2015년 11월 11일
편집: Stephen23 2015년 11월 11일
Most likely the variable Matrix is a numeric array, and you are trying to assign a cell array to one of its elements. This is an error, because you cannot assign a cell array as an element of a numeric array. Basically you are doing this:
num_array(x) = cell_array
You can either assign that cell to another cell array, or else assign numeric values to a numeric array.

카테고리

Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by