saveas throws "Invalid Simulink object handle" error
Show older comments
Hello All,
I am trying to save a plot in .png format. I am using a code which looks something like this:
figure (2)
h2 = hist(variable1(:,2),50);
xlabel('Error');
ylabel('Error Distribution');
string1 = strcat('Histogram',10,'Variable1'); %10 is added for \n
title(string1);
saveas(h2,'better_system\hist_variable1.png');
when I run this piece of code, I see the following error:
??? Error using ==> saveas at 73 Invalid Simulink object handle.
Answers (1)
TAB
on 20 Sep 2011
hist not returns the figure handle. See 'help hist'.
Try
h2=figure(2);
hist(variable1(:,2),50);
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!