Deleting lines and underlying data with button click / key press.

4 views (last 30 days)
Hi all,
I have a structure with 12 fields. Each field contains a 10x1 cell. Each cell contains a 1x500 double.
What I currently do is parse through the data with a simple for loop where I plot the contents of each cell, one at a time. At every iteration of a plot, I use a menu to get feedback on whether to accept or delete the 1x500 double. If the user chooses to accept, what I do is save the loop's iteration # for that particular cell as a way to index it for reference in the future.
I'm at the point now where I can see how tedious this is going to be with massive amounts of data. What I'd like to do is maybe plot the contents of each 10x1 cell at a time and use the "buttondownfunction" or "keypressfunction" to delete lines from the graph (as well as updating the cell after deletion).
I'm new to working with using keys and button-clicks and to keep things simple I've been working a dummy data set and here's what I have so far:
function dum
load dum.mat;
global p;
figure;
k=1;
for i = 1:2
for j = 1:2
p(k) = plot(dumStruct.dumCell{j},'buttondownfcn',@lineCallback);
set(p(k),'UserData',k)
k=k+1;
hold on
end
end
function [] = lineCallback(src,~)
h = gco
plot_delete = get(h,'UserData')
% if plot_delete == %search for stored 'UserData' contents from p(k)
% % Then delete that data from the cell
% % and
% % Delete line from figure with delete(gco);
% end
Here I have some basic idea of how to delete lines in the plot with a left-click but my question is how do I update the corresponding cell after each deletion? I thought to save every plots handle and use the 'UserData' property as a unique identifier which I set as the 'k' value from the loops iteration. When I click on a line in the plot, lineCallback() will grab the handle for current object. I'm not sure how to conduct a fast search and whether I'm doing all of this entirely right. Any guidance would be greatly appreciated. Thank you very much for your time.

Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!