Hello,
I have the following code:
for ii = 1:length(tempSpikes)
p(ii) = plot(app.Trace, tempSpikes(ii)*app.msConvert, app.xi(app.m.mainCh,tempSpikes(ii)),'k*');
end
set(p, 'ButtonDownFcn', {@pointSelected, app.Trace, p})
set(app.Trace,'UserData', []);
This plot loop plots 100s to 1000s of individual markers that can be clicked on using the callback pointselected.
pointselected is a function that just flags which markers have been selected/deselected.
This plotting process takes a long time (>10 sec), and using figure tools like zoom and pan are very slow also.
Is there a way to speed this up? I tried replacing the plot command with scatter and that was 3 times as slow.
Thanks!
Edit: The plot I have has the xaxis range from 0 to 2e5 while the yaxis ranges from -1000 to 1000 at a aspect ratio of 2:1. So using ginput and distance finding is not ideal as the distance in the xaxis is much greater per pixel causing unexpected points to be chosen if the mouse is slightly off the point.
Also ideally I would like the points to be clickable and unclickable infinitely until I press a button to act on the data. I may be zooming in and out between clicking points and clicking other buttons on the GUI. ginput locks me into point collection mode.