So i have a set of code that creates a bunch of figures for me. I would then like to extract the data from said figures.
Above are two examples of the figures.
Overlaid they look like this
These figures are origionally plotted using
function plotSpectrum(h,x,y,scale,colour)
if nargin < 5 colour='black'; end
if nargin < 4 scale=1; end
ylimits=[min(real(y)),max(real(y))/scale];
set(p,'color',colour,'LineWidth',1);
set(h,'xlim',xlimits,'ylim',ylimits,'xdir','reverse');
and overlaid using
fh1 = open('1hydrogen.fig');
fh2 = open('2hydrogen.fig');
ax1 = get(fh1, 'Children');
ax2 = get(fh2, 'Children');
ax2p = get(ax2(1),'Children');
So i then try to extract the data
dinfo = dir(fullfile(data,'*gen.fig'));
numfig = length(fignames);
inter_y = cell(numfig, 1);
inter_z = cell(numfig, 1);
fig = openfig(figfile,'invisible');
ax = get(fig, 'CurrentAxes');
hline = get(ax, 'Children');
y{K} = get(hline,'XData');
z{K} = get(hline,'YData');
inter_y{K} = y{K}(1,5:124);
inter_z{K} = abs(z{K}(1,5:124));
Then if i use something to test this extraction like.
I get
Which is clearly different to the other overlay example. I am trying to get it so that my extracted data looks the same when plotted as the origional as this is needed for later coding.
Any help would be appreciated.