Graphically select multiple regions on the x-axis, store those intervals, and highlight those regions

1 view (last 30 days)
Hello,
I'm trying to easily select "bands" for feature detection in signals. It takes a while to prompt the user (by manually typing) for each interval they want to select. I've seen how you can highlight a region using the "patch" function. Can I event bind the left-click and drag to select multiple regions, and right-click to indicate you're finished with making selections?
Ideally it would look like this: example is just y=sin(pi*x)/(pi*x)
An example of getting the x-intervals can be achieved using "get" on the handle for the axes
hax = axes( ... , 'ButtonDownFcn', @OnClickAxes);
function OnClickAxes( hax, evt )
point1 = get(hax,'CurrentPoint'); % hax is handle to axes
rbbox;
point2 = get(hax,'CurrentPoint'); % hax is handle to axes
%points are corners of the rectangle
end
But I don't know how I would put the patch function into the onClickAxes function. Does anyone have experience with real-time graph manipulation? Seems to be a higher tier of matlab expertise that I don't have yet.

Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!