MATLABの数値は、複雑な階層オブジェクトであるので、ユニバーサル「形式の画家」を作ることはほとんど不可能であろう。
figure、axes、lineなどのプロパティは構造体として取得できますが、多くは読み込み専用です。
1軸、同様の種類のプロット、同じ数のデータシリーズ、手動注釈がない場合は、おそらく簡単な方法で1つの図からデータを取得し、必要な図形に適用します標準として使用する
図形がすべて散らばっている場合、オブジェクトの種類は線(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
出典
2012-02-08 17:57:22
yuk