Selecting a point on a scatter plot, saving index of point
What is the best way to allow a user to select 5 data points on a scatter plot and then save the index of these plots?
Code I am currently using:
disp(‘Following the trajectory from <start> to <end>, please click 5 points on the plot where you think the keypress moments are, press Enter to confirm’);
% Save points selected on plot by user
[user_selected_keypressframes] = ginput;
% Extract coordinates for each user selected point and save
[uskf1] = user_selected_keypressframes(1,:);
[uskf2] = user_selected_keypressframes(2,:);
[uskf3] = user_selected_keypressframes(3,:);
[uskf4] = user_selected_keypressframes(4,:);
[uskf5] = user_selected_keypressframes(5,:);
Issue:
This code allows the user to click/select any area within the plot, I want them to only be able to click/select data points so I can save the index of these points.What is the best way to allow a user to select 5 data points on a scatter plot and then save the index of these plots?
Code I am currently using:
disp(‘Following the trajectory from <start> to <end>, please click 5 points on the plot where you think the keypress moments are, press Enter to confirm’);
% Save points selected on plot by user
[user_selected_keypressframes] = ginput;
% Extract coordinates for each user selected point and save
[uskf1] = user_selected_keypressframes(1,:);
[uskf2] = user_selected_keypressframes(2,:);
[uskf3] = user_selected_keypressframes(3,:);
[uskf4] = user_selected_keypressframes(4,:);
[uskf5] = user_selected_keypressframes(5,:);
Issue:
This code allows the user to click/select any area within the plot, I want them to only be able to click/select data points so I can save the index of these points. What is the best way to allow a user to select 5 data points on a scatter plot and then save the index of these plots?
Code I am currently using:
disp(‘Following the trajectory from <start> to <end>, please click 5 points on the plot where you think the keypress moments are, press Enter to confirm’);
% Save points selected on plot by user
[user_selected_keypressframes] = ginput;
% Extract coordinates for each user selected point and save
[uskf1] = user_selected_keypressframes(1,:);
[uskf2] = user_selected_keypressframes(2,:);
[uskf3] = user_selected_keypressframes(3,:);
[uskf4] = user_selected_keypressframes(4,:);
[uskf5] = user_selected_keypressframes(5,:);
Issue:
This code allows the user to click/select any area within the plot, I want them to only be able to click/select data points so I can save the index of these points. selecting points MATLAB Answers — New Questions