function lmk = landid(x,t,p) %function lmk = landid(x,t,p) % %Graphical landmark identification % %INPUT % x: data matrix (n x m) % t: time grid (1 x m) % p: number of landmarks per curve (scalar) % %OUTPUT % lmk: landmark matrix (n x p) % %NOTE: This routine draws each curve on X so you can manually identify the % landmarks by clicking on the plot. Note that X is not necessarily % the data matrix to be registered: in many cases it's easier to spot % landmarks using first or second derivatives. % More specifically, this routine assumes that your landmarks are % zero crossings, so it draws a horizontal line at y=0 for better % visualization. % %No external routines are called. %Checking input consistency [n,m] = size(x); if length(t)~=m disp('Dimensions of T and X are inconsistent') lmk = []; return elseif size(t,1)==m t = t'; end lmk = zeros(n,p); for i = 1:n plot(t,x(i,:),t,zeros(size(t))) hold on for j = 1:p title(['Curve ' num2str(i) ': click on graph to identify landmark ' num2str(j) ... ' of ' num2str(p)]) [lmk(i,j),y] = ginput(1); plot(lmk(i,j),0,'ro') end hold off end