Plot a signal, manually brush data range, and generate new variable
8 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!