What is wrong with this savefig and Openfig in the following script in the FOR Loop?
조회 수: 1 (최근 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!