I have a plotting function which gets the points to plot from a for loop, i.e.
for i=1:length(rat2ind) ind = A(:,1)==A(rat2ind(i),1); % pick all the rat locs for rat i
plot(A(ind,2),A(ind,3),randcolor);axis([-0.5 7.5, -0.5 7.5]) % plot rat i trajectory
hold on; end
but instead of plotting the points, I'd like to save the points in an (n,2) array. I tried this:
for i=1:length(rat2ind) ind = A(:,1)==A(rat2ind(i),1); H=vertcat(H,[A(ind,1),A(ind,2),A(ind,3)]); end
but it gave me a variable which is definitely not what I needed as its twice as large as my original data (the data, and my actual goal isn't really relevant here)
Thanks for any help
Best Answer