Matlab无窗口绘制多个图形

Matlab无窗口绘制多个图形,matlab,matlab-figure,Matlab,Matlab Figure,我正在尝试使用隐藏的Matlab图形进行绘图,以加快绘图速度: a=1:10; b=-a; % make invisible plot window f = figure('visible','off'); g = figure('visible','off'); % figure makes the plot visible again figure(f) plot(a) saveas(f,'newout','fig') figure(g) plot(b) saveas(

我正在尝试使用隐藏的Matlab图形进行绘图,以加快绘图速度:

a=1:10; b=-a;
% make invisible plot window 
f = figure('visible','off');
g = figure('visible','off');

% figure makes the plot visible again    
figure(f)    
plot(a)
saveas(f,'newout','fig')

figure(g)
plot(b)
saveas(g,'newout2','fig')

%% load saved figures    
openfig('newout.fig','new','visible')
openfig('newout2.fig','new','visible')
问题在于使绘图窗口再次可见的图(f)命令。
当我只有一个绘图并且没有调用图(f)时,代码绘图没有图窗口。

我建议创建一个全新的绘图窗口。通过这样做,你将得到两个不同的图,正如你所说的,只有一个图有效,我认为它可以有效

我建议制作一个全新的绘图窗口。通过这样做,你将得到两个不同的图,正如你所说的,只有一个图有效,我认为它可以有效

我刚刚了解到,与其调用
图(f)
不如使用set:

set(0, 'currentfigure', g);
这将更改当前地物控制柄,而不更改其可见性。 更正后的版本按预期工作:

a=1:10; b=-a;
% make invisible plot window 
f = figure('visible','off');
g = figure('visible','off');

% figure makes the plot visible again    
set(0, 'currentfigure', f);
plot(a)
saveas(f,'newout','fig')

set(0, 'currentfigure', g);
plot(b)
saveas(g,'newout2','fig')

%% load saved figures
close all
openfig('newout.fig','new','visible')
openfig('newout2.fig','new','visible')

我刚刚了解到,与其调用
图(f)
,不如使用set:

set(0, 'currentfigure', g);
这将更改当前地物控制柄,而不更改其可见性。 更正后的版本按预期工作:

a=1:10; b=-a;
% make invisible plot window 
f = figure('visible','off');
g = figure('visible','off');

% figure makes the plot visible again    
set(0, 'currentfigure', f);
plot(a)
saveas(f,'newout','fig')

set(0, 'currentfigure', g);
plot(b)
saveas(g,'newout2','fig')

%% load saved figures
close all
openfig('newout.fig','new','visible')
openfig('newout2.fig','new','visible')

另一种解决方案是在
绘图
命令中参考轴(而不是在
绘图
之前更改当前图形):


另一种解决方案是在
绘图
命令中参考轴(而不是在
绘图
之前更改当前图形):


我已经有两个绘图,f和g,并且希望在不改变其可见性的情况下在它们之间切换。我已经有两个绘图,f和g,并且希望在不改变其可见性的情况下在它们之间切换。请参阅图的帮助中的提示部分()请参阅图的帮助中的提示部分()!你能接受你的答案从而关闭线程吗?是的,但只有在2天后。很高兴知道!你能接受你的答案从而关闭线程吗?是的,但只有在2天后。