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?

 Respuesta aceptada

KSSV
KSSV el 11 de Abr. de 2018
Editada: KSSV el 11 de Abr. de 2018
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 comentarios

got this error: Cell contents reference from a non-cell array object.
Give your data of the variables in the code.
Here is the variable
Edited the answer.
Thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 10 de Abr. de 2018

Comentada:

el 11 de Abr. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by