I'm attempting to make a very basic gating system, however the smallest data I have is single cycle which equals a 18*100 array. I've attempted just plotting it with a hold on/off function and collecting the data after with a 'h=findobj(gca,'Type','line');'. However this takes forever and requires a lot of reshaping. Is there a simpler way to either store the data or add the complete arrays (not sum as that does line by line which is a no-no) together in the for loop?
h=findobj(gca,'Type','line'); %data retrieved from orginal figure
x=get(h,'Xdata');
y=get(h,'Ydata');
X=reshape(x,(18),[]);
Y=reshape(y,(18),[]);
hold on
for i=1:4;
xx=X(:,i);
yy=Y(:,i);
gx=cell2mat(xx);
gy=cell2mat(yy);
plot(gx) % manipulated data from orginal figure,
plot(gy) % plot required to extract all the for loop data
end
hold off
Basically I just want to add the four gx together and divide them, however they have to be added as bulk, not line by line as one cycle of the loop equals a cycle of the system. (Also the 4 is just a number it really is more like 60+, which is why I can't just do it manually).
Many thanks!
gx
s together, why not do this -sum(cell2mat(X),2)
and similarly forgy
s? But then you won't be able to plot individualgx
andgy
. – Divakar Apr 9 at 5:2618 x 100
and you want to sum them to equal another18 x 100
matrix? Why do you need to get your data out of the figure, don't you already have it and if not how are you putting it into the figure in the first place? – nkjt Apr 9 at 9:22