Browsing through figures, without opening them all

7 vues (au cours des 30 derniers jours)
Peter
Peter le 26 Sep 2022
Commenté : Peter le 5 Oct 2022
Hi!
I often print/save figures in png-format or similar, in order to be able to quickly browser through results, either using a photoviewer-program or plotting them into a pdf. However, In the the matlab-figures i usually include hidden data in for example lines and buttons/functions which I would be interested in accessing when browsing through them. (ex. buttondownfunctions on lines etc.)
I'm wondering if there is a way of browsing trough .fig files in a fast way, without opening them each separately?
Regards
Peter

Réponses (1)

Voss
Voss le 26 Sep 2022
You can use load to inspect .fig files programmatically:
f = figure();
plot(1:10,'ButtonDownFcn','disp(''ok'')');
saveas(f,'1.fig')
delete(f);
ff = load('1.fig','-mat')
ff = struct with fields:
hgS_070000: [1×1 struct] hgM_070000: [1×1 struct]
ff.hgS_070000
ans = struct with fields:
type: 'figure' handle: 1 properties: [1×1 struct] children: [1×1 struct] special: []
ff.hgS_070000.children
ans = struct with fields:
type: 'axes' handle: 11.0002 properties: [1×1 struct] children: [1×1 struct] special: [4×1 double]
ff.hgS_070000.children(1).children(1)
ans = struct with fields:
type: 'graph2d.lineseries' handle: 22.0002 properties: [1×1 struct] children: [] special: []
ff.hgS_070000.children(1).children(1).properties
ans = struct with fields:
XData: [1 2 3 4 5 6 7 8 9 10] XDataMode: 'auto' YData: [1 2 3 4 5 6 7 8 9 10] Color: [0 0.4470 0.7410] ColorMode: 'auto' DimensionNames: {'X' 'Y' 'Z'} DimensionNamesMode: 'auto' ButtonDownFcn: 'disp('ok')' SeriesIndex: 1 SeriesIndexMode: 'auto' ApplicationData: [1×1 struct]
ff.hgS_070000.children(1).children(1).properties.ButtonDownFcn
ans = 'disp('ok')'
  1 commentaire
Peter
Peter le 5 Oct 2022
Hi and thank you for your answer!
I don't think that is what I'm looking for, since for now, my actions will be based on what i see in the picture.
For example, one (out of hundreds) figure may contain 100 lines. If a line looks suspicious, I want to load/execute certain functions based on the data contained within the line object.
In lack of other ideas I may need to create a interactive GUI for this.
Regards
Peter

Connectez-vous pour commenter.

Catégories

En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange

Tags

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by