Cell contents assignment to a non-cell array object.

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

Antworten (1)

per isakson
per isakson am 23 Mär. 2014
Bearbeitet: per isakson am 23 Mär. 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.

Kategorien

Mehr zu Graphics Object Properties finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

am 23 Mär. 2014

Kommentiert:

Xi
am 25 Aug. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by