this is an idea of what you need and should help you get started if I understand your requirements.
In this case, when you select a curve, it will draw it in the lower subtitle, keeping the color.
function main
subplot(211)
h = plot (peaks);
set (h,'buttondownfcn', @hitme)
end
function hitme(gcbo,evendata)
subplot (212)
hold on;
col = get (gcbo,'Color');
h2 = plot (get (gcbo,'XData'),get (gcbo,'YData'));
set (h2,'Color', col)
pt = get (gca, 'CurrentPoint');
disp (pt);
end
You can explore your options just to write get(gcbo)in functions hitme.
source
share