Cell contents assignment to a non-cell array object.

1 visualización (últimos 30 días)
Bradley
Bradley el 23 de Mzo. de 2014
Comentada: Xi el 25 de Ag. de 2014
Hello, I am encountering the following errors in my MATLAB program:
  • * * **COMMAND LINE**** * * *
Cell contents assignment to a non-cell array object.
Error in FileName (line 11) Comfort{count}='!!!';
  • * * * **SCRIPT FILE**** * * * *
for count=1:1:20
C(count) = -50+200*rand(1);
K(count) = C(count)+273.15;
F(count) = C(count)*9/5+32; %converting celsius to fahrenheit
R(count) = C(count)*1.8+491.67;
if F(count)>32
if F(count)>55
if F(count)>70
if F(count)>90
if F(count)>105
Comfort{count}='!!!';
else
Comfort{count}='hot';
end
else
Comfort{count}='warm';
end
else
Comfort{count}='mild';
end
else
Comfort{count}='cold';
end
else
Comfort{count}='freeze';
end
end
for count=1:20
fprintf('\n %.0f %.0f %.1f %.2f %.1f %s\n', count,C(count), K(count), F(count), R(count), Comfort{count});
end

Respuestas (1)

per isakson
per isakson el 23 de Mzo. de 2014
Editada: per isakson el 23 de Mzo. de 2014
Add
clear('Comfort')
at the top of the script. Or better add
Comfort = cell( 1, 20 );
at the top. Most likely Comfort hold some old data of another type.

Categorías

Más información sobre Dialog Boxes en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by