简体   繁体   中英

Save figure by using MATLAB Command Window

I want to generate a figure and save it by using the MATLAB Command Window, after open it by a shell command from VBA. The following error message is displayed when I try to open a figure:

在此处输入图片说明

In my MATLAB code I am using the following lines, to save the figure:

figure('Visible','off');
imagepath = 'myPath.jpg';
plot(1:100);
saveas(gcf,imagepath);
close(gcf);

Has anyone an idea or some experience with that kind of problem?

Thank you

The problem is you're saving something that's not your figure... gcf=figure('Visible','off'); should do the trick...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM