Loading a fig file without opening
조회 수: 72 (최근 30일)
이전 댓글 표시
Hi,
I have .fig in the current directory and wish to extract data from it. I used the following code for this purpose,
open('power.fig');
a = get(gca,'Children');
xdata = get(a, 'XData');
ydata = get(a, 'YData');
The code works. My problem is it also opens the fig file in a separate figure window. I don't want that to happen. I just want to extract the data.
Ofcourse I could use,
close figure
But it just takes out the graph and shows an empty figure window.
I would be very much grateful if somebody could help me in this.
Thanks in advance!
댓글 수: 0
채택된 답변
Fangjun Jiang
2021년 2월 8일
편집: Fangjun Jiang
2021년 2월 8일
f=openfig('power.fig','invisible')
a=get(f,'Children')
...
close(f)
clear f
댓글 수: 3
Gabriele Bellomia
2022년 5월 13일
Try this:
>> load test.fig -mat hgS_070000
>> hgS_070000
hgS_070000 =
struct with fields:
type: 'figure'
handle: 1
properties: [1×1 struct]
children: [1×1 struct]
special: []
It should work, I just tested it on R2020b Update 7 and it does.
But beware that is undocumented (and probably unintended) behavior. So it might change suddenly.
More info here: https://undocumentedmatlab.com/articles/fig-files-format
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Debugging and Analysis에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!