Browsing through figures, without opening them all

2 ビュー (過去 30 日間)
Peter
Peter 2022 年 9 月 26 日
コメント済み: Peter 2022 年 10 月 5 日
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

回答 (1 件)

Voss
Voss 2022 年 9 月 26 日
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 件のコメント
Peter
Peter 2022 年 10 月 5 日
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

サインインしてコメントする。

カテゴリ

Find more on Graphics Object Identification in Help Center and File Exchange

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by