How to save a fig file and re-open it with the same figure number?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Darcy Cordell
il 5 Ott 2022
Risposto: Eric Delgado
il 5 Ott 2022
Very simple question which I cannot find a simple answer to:
If I save a figure with a particular figure number as a *.fig file, is there a way to keep that figure number information when reopening the figure using openfig?
Example:
f = figure(1000);
fNumber= f.Number; %result = 1000
savefig(f,'figure1000.fig')
close(f)
clearvars
g = openfig('figure1000.fig');
gNumber = g.Number; %result = 1
This example results in fNumber = 1000 and gNumber = 1. When I save a figure, I want MATLAB to be able to open the figure exactly as it was, including the figure number. Might be missing something obvious here...
Any help is appreciated.
0 Commenti
Risposta accettata
Eric Delgado
il 5 Ott 2022
Try this!
f = figure(1000);
ax = axes(f);
plot(ax, randn(1001, 1)) % Let's create some data visualization!
savefig(f,'figure1000.fig')
close(f)
clearvars
g = openfig('figure1000.fig', 'invisible');
h = figure(1000);
copyobj(g.Children, h)
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Printing and Saving in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!