How do I copy figure properties from one to another?
4 次查看(过去 30 天)
显示 更早的评论
I would like to copy the properties from Fig 1 to Fig 2. How can that be done?
0 个评论
回答(1 个)
Walter Roberson
2024-8-3
编辑:Walter Roberson
2024-8-3
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!