How do I copy figure properties from one to another?
14 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I would like to copy the properties from Fig 1 to Fig 2. How can that be done?
0 Commenti
Risposte (1)
Walter Roberson
il 3 Ago 2024
Modificato: Walter Roberson
il 3 Ago 2024
The below code sets all sensible properties.
fig1 = openfig('Fig 1.fig');
fig2 = openfig('Fig 2.fig');
propnames = fieldnames(set(fig1));
if strcmp(fig2.WindowStyle, 'docked')
propnames = propnames(~ismember(propnames, ...
{'InnerPosition', ...
'OuterPosition', ...
'Position'}));
end
propnames = propnames(~ismember(propnames, ...
{ 'Children', ...
'CurrentAxes', ...
'CurrentCharacter', ...
'CurrentObject', ...
'CurrentPoint', ...
'FileName', ...
'IntegerHandle', ...
'Parent', }));
set(fig2, propnames, get(fig1, propnames));
savefig(fig2, 'New Fig 2.fig');
10 Commenti
Walter Roberson
il 3 Ago 2024
The legend of the plot is not a figure property: it is an axes property.
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!