What is wrong with this savefig and Openfig in the following script in the FOR Loop?
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!