Strange behaviour of 'saveas' function
3 次查看(过去 30 天)
显示 更早的评论
I've a complex vector of 409600 elements. I do the scatterplot of the elements and then save as jpg image 600 x 800.
% iq is the name of the vector
figure('position',[1,1,800,600]);
plot(imag(iq),real(iq),'r-*');
title('SCATTERPLOT');
saveas(gcf,'scatterplot.jpg', jpg);
The result is:
??? Error using ==> plot
Invalid first data argument
Error in ==> scatterplot at 121
plot(yy, zeros(1,len_yy), plotstring);
Error in ==> print at 2
scatterplot(in,1,1,'k-o');
Error in ==> saveas at 154
print( h, name, ['-d' dev{i}] )
Is very annoying because sometimes it works, sometimes doesn't; and I can't understand the reason. Plus, if I save in 'fig? format it always works.
saveas(gcf,'scatterplot','fig'):
Can somebody help me to solve this easy code??
0 个评论
回答(2 个)
Image Analyst
2012-7-4
Have you tried the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_save_my_figure.2C_axes.2C_or_image.3F_I.27m_having_trouble_with_the_built_in_MATLAB_functions.
By the way, it's strange that the line it complains about
plot(yy, zeros(1,len_yy), plotstring);
is not in the code you posted. Why is that? What is line 121 of your scatterplot.m? Or actually, what is yy and len_yy there when it crashes there? Do you know how to use the debugger to set breakpoints and examine variables?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Printing and Saving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!