MATLAB の Figure は複雑な階層オブジェクトであるため、汎用の "フォーマット ペインタ" を作成することはほとんど不可能です。
Figure、Axes、Line などのプロパティを構造体として取得できますが、それらの多くは読み取り専用です。
単純な図 (1 つの軸、同様のタイプのプロット、同じ数のデータ シリーズ、手動注釈なし) を扱っている場合、おそらく、1 つの図からデータを取得し、それらを使用したい図に適用するのがより簡単な方法です。標準。
Figure がすべて散布図の場合、オブジェクト タイプは line (plot を使用する場合) または hggroup (散布図を使用する場合) です。だから彼はそれができる方法の例です。
fstd = hgload('standard.fig'); %# load standard figure
f1 = hgload('f1.fig'); %# load another figure
%# find data series objects
hstd = findobj(gcf,'type','line','-or','type','hggroup');
h1 = findobj(gcf,'type','line','-or','type','hggroup');
assert(numel(hstd)==numel(h1),'Figures have different number of data series')
%# get the data coordinates from one figure and apply to another
for k = 1:numel(hstd)
h1x = get(h1(k),'XData');
h1y = get(h1(k),'YData');
h1z = get(h1(k),'ZData');
set(hstd(k),'XData',h1x);
set(hstd(k),'YData',h1y);
set(hstd(k),'ZData',h1z);
end
hgsave(hstd,'f1mod.fig') %# save the modified figure