フィルターのクリア

What is wrong with this savefig and Openfig in the following script in the FOR Loop?

2 ビュー (過去 30 日間)
Chin Kui Ku
Chin Kui Ku 2018 年 9 月 11 日
編集済み: Chin Kui Ku 2018 年 9 月 11 日
Openfig does not open the saved fig files correctly. seems like the .fig file is corrupted. The .fig file can be opened if i removed the For Loop and run it one at a time.
Code example as follows: %% g=[1 2 3];
for g = 1:length(g)
f1=figure;
y= 1:1:100; x= 1:1:100;
subplot (211);
plot(x,y, 'DisplayName','ADS value'); hold on;
scatter(x,y, 'x','DisplayName','ADS value'); hold off;
ttitle = sprintf('%d plot 1',g); title(ttitle);
subplot (212)
y1= 1:1:200; x1= 1:1:200;
plot(x1,y1, 'DisplayName','ADS value'); hold on;
scatter(x1,y1, 'x','DisplayName','ADS value'); hold off;
ttitle = sprintf('%d plot 2',g); title(ttitle);
legend('Location','southeastoutside');
filename = sprintf("testing (%d).fig", g); savefig(f1,filename);
end
openfig("testing (1).fig")
openfig("testing (2).fig")
openfig("testing (3).fig")
% Appreciate if you can tell me what's wrong with the code. % Thank you.

回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by