필터 지우기
필터 지우기

Plot a signal, manually brush data range, and generate new variable

조회 수: 11 (최근 30일)
Sean Quisenberry
Sean Quisenberry 2017년 9월 26일
답변: Ramnarayan Krishnamurthy 2017년 10월 3일
I am looking for a means to plot a signal, and have the brush function automatically on. Manually select that data range (mostly the peaks), and then automatically create a new variable (with a predefined name).
I am trying to cut out the select brush data, then right-click the data, select create new variable and type in the new name.

답변 (1개)

Ramnarayan Krishnamurthy
Ramnarayan Krishnamurthy 2017년 10월 3일
To programmatically implement selecting brush data, saving it to a newly created variable, you can try the following approach:
% Plot Random data
a = plot(rand(10,1));
% Enable Brush
brush on
% Now manually select brush data on the plot using the mouse
% then run the lines below
% Obtain indices of brushed values
ind = find(get(a, 'BrushData'));
% Obtain x and y brushed values
brush = logical(get(a, 'BrushData'));
xd = get(a, 'XData');
yd = get(a, 'YData');
brushed_x = xd(brush);
brushed_y = yd(brush);
There is an elaborate discussion of the above solution at:
A few other approaches that may be applicable to your use case are:
Of particular interest may be the "Graphical data selection tool" on File exchange.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by