Error using double. Conversion to double from cell is not possible

for i=1:length(centroidA)
if ED1Vertical(i) >= ED2Vertical(i);
status(i) = {'less'};
elseif ED1Vertical(i) <= ED2Vertical(i);
status(i) = {'more'};
else
status(i) = {'equal'};
end
end
Error: Error using double. Conversion to double from cell is not possible.
centroidA is 11x1 cell with 1x2 double elements.
ED1Vertical and ED2Vertical are 11x1 double.
What is wrong with the code and how can I solve this?

 採用された回答

KSSV
KSSV 2018 年 4 月 11 日
編集済み: KSSV 2018 年 4 月 11 日

0 投票

N = length(centroidA) ;
status = cell(N,1) ;
for i=1:N
if ED1Vertical(i) >= ED2Vertical(i)
status{i} = 'less';
elseif ED1Vertical(i) <= ED2Vertical(i)
status{i} = 'more';
else
status{i} = 'equal';
end
end

5 件のコメント

NURFATIN NADIA
NURFATIN NADIA 2018 年 4 月 11 日
got this error: Cell contents reference from a non-cell array object.
KSSV
KSSV 2018 年 4 月 11 日
Give your data of the variables in the code.
NURFATIN NADIA
NURFATIN NADIA 2018 年 4 月 11 日
Here is the variable
KSSV
KSSV 2018 年 4 月 11 日
Edited the answer.
NURFATIN NADIA
NURFATIN NADIA 2018 年 4 月 11 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by