MATLAB Answers

Loading a fig file without opening

17 views (last 30 days)
JPS
JPS on 8 Feb 2021
Commented: JPS on 11 Feb 2021
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!

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 8 Feb 2021
Edited: Fangjun Jiang on 8 Feb 2021
f=openfig('power.fig','invisible')
a=get(f,'Children')
...
close(f)
clear f
  1 Comment
JPS
JPS on 11 Feb 2021
Thank You Mr. Fangjun Jiang !

Sign in to comment.

More Answers (0)

Tags

Products

Community Treasure Hunt

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

Start Hunting!

Translated by