How to recall a figure which was generated by a name "fname = figure; figure(fname)" without saving it ?
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I have many figures and for validation purpouse, I have a file1.m file which generate many figures. I clean the worskspace without closing figures and I run file2.m. I want to have the results of file2 to be put on those of file1. This is straightforward when you use figure(1),...,figure(100). However, I have many figures and rather than remembering the correspondance between the variables to be plot and the figure numbers, I want to have something like this:
fpressure = figure; figure(fpressure);
ftemperature = figure;figure(ftemperature)
This works perfectly within one file. As soon as I use clear command, it is forgotten which figure was fpressure and ftemperature. So the file2's plots wont be on those have been generated before. Is there any mean to do what I want to do ?
Regards,
Mary
0 Commenti
Risposte (1)
Fangjun Jiang
il 28 Mag 2020
Modificato: Fangjun Jiang
il 28 Mag 2020
When you run fpressure=figure, it creates the figure object handle fpressure. But after you clear the workspace, the figure object handle is gone although the figure window still exists. You can "find" those figure obejct handles but won't be able to match by figure object handle name. I suggest you add some keywords to be able to find it later.
close all; clear all;
fpressure=figure;ftemperature=figure;
clear;
f=findall(0,'type','figure')
close all; clear all;
fpressure=figure('name','pressure');
ftemperature=figure('name','temperature')
clear
fpressure=findall(0,'type','figure','name','pressure')
5 Commenti
Fangjun Jiang
il 10 Giu 2020
Modificato: Fangjun Jiang
il 10 Giu 2020
Please read it again. In the first section, I was trying to explain that you could find the figure but couldn't tell which one is which because there is no keyword (or anything to identify the figure).
In the second section, you can find and match.
If you ran both section of the code, there are two figures left. The two created in the first section were closed by "close all".
The solution is in the second section, if you could understand it.
Vedere anche
Categorie
Scopri di più su Specifying Target for Graphics Output 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!