Cell contents assignment to a non-cell array object.
Show older comments
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
Answers (1)
per isakson
on 23 Mar 2014
Edited: per isakson
on 23 Mar 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.
1 Comment
Xi
on 25 Aug 2014
clear('comfort') really helps!
Categories
Find more on Graphics Object Properties in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!