I want to write a code that plots columns in a matrix one by one. while plotting, the code should allow few seconds to look at each column plotted before moving to the other one.
During those few seconds the user should have the ability to save the plotted vector to a new matrix by clicking on the figure.
x=[1 2 3;4 5 6;7 8 9]%for matrix creation
%hold on%this function for multiple plots
for i=1:3
plot(x(:,i))
pause(2)
end
hold off
for i=1:3
[x]=ginput(i)%this function for print the ploted vector
end
The problem with my code is:
1- I could not implement the clicking after every vector
2- clicking with ginput gives 1 point and the whole plotted vector
(any help for either problems is appreciated)
I solved it by an if statement instead.
sample = data(150:220,:);
new =[];
for i=1:size(data,2)
plot(sample(:,i))
[x,y]=ginput(1);%this function for print the ploted vector
if y < 0
disp('small')
else
new = [new,sample(:,i)];
end
end