Hi. I would like to save the figure I get using the 'findobj' function.
I have this code and I want to save the last figure that is shown on the screen:
fig_1 = openfig("fig1.fig");
fig_2 = openfig("fig2.fig");
fig_3 = openfig("fig3.fig");
fig_4 = openfig("fig3.fig");
L1 = findobj(fig_1,'type','line');
copyobj(L1,findobj(fig_4,'type','axes'));
L2 = findobj(fig_2,'type','line');
copyobj(L2,findobj(fig_4,'type','axes'));
destdirectory_FIG = 'C:\Users\Alberto\Desktop\....';
savefig(L2, fullfile(destdirectory_FIG, 'name_of_FIG.fig')); % ???
Can anyone tell me how to modify the code?

댓글 수: 3

Walter Roberson
Walter Roberson 2022년 11월 23일
No, we do not know which is the last one shown on the screen. openfig() uses the stored Visible property so we do not know which of the figures are visible or not.
Alberto Acri
Alberto Acri 2022년 11월 24일
@Walter Roberson Is it possible to get the same figure in such a way that it can be saved?
Walter Roberson
Walter Roberson 2022년 11월 24일
you findobj line and axes but not figures, so there is no "same figure"

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2022년 11월 24일

0 개 추천

savefit(fig_4, fullfile(destdirectory_FIG, 'name_of_FIG.fig'))

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

릴리스

R2021b

질문:

2022년 11월 23일

답변:

2022년 11월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by