Graphically select multiple regions on the x-axis, store those intervals, and highlight those regions
1 回表示 (過去 30 日間)
古いコメントを表示
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 the patch highlighting is found in https://www.mathworks.com/matlabcentral/answers/387507-highlight-a-section-of-a-plot#answer_309415
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.
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Polygons についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!