Is it possible to brush data on a plot and have it assigned to a variable immediatly after brushing instead of having to save it manually?

조회 수: 6 (최근 30일)
I would like to plot data, once plotted I would be directed to brush the data I want to use. Following the brush I would like to click the enter key and have code in matlab to save what I brushed without me having to do it manually.

채택된 답변

Cindy Solomon
Cindy Solomon 2015년 7월 27일
편집: Cindy Solomon 2015년 7월 27일
Hi Calabrese,
There is no in-built functionality to do this in MATLAB, but there a few potential workarounds that you could look into:
1) This function on File Exchange has a lot of interesting functionality that other users have found helpful and recommended in similar use cases.
2) Adding a function to the callback that executes once data is brushed. (This callback is called ActionPostCallback.)
3) Adding some sort of event-listener to a property, such as the example here.
I hope this helps!
  댓글 수: 2
Calabrese
Calabrese 2015년 7월 27일
What is this function on File Exchange? Could you maybe provide an example to the ActionPostCallback and event-listner?
figure(1)
plot(Time,IAMHS,'y', Time,CMP1,'m', Time,CMP2,'c', Time,PDU_OP,'r',...
Time,ThreePThreeV,'g', Time,TenV_PREF,'b', Time,TenV_REF,'k')
title('all parameters')
axis([min(Time),max(Time),4.7,5.3])
pause
I am plotting 7 sets of data in a line plot
I use the brushing tool to select the chunks of data I would like to further evaluate. I am selecting an equal number of points for each of the 7 sets of data on the one plot.
Is there a way to reassign the variables IAMHS, CMP1, CMP2, PDU_OP, ThreePThreeV, TenV_PREF, and TenV_REF to the new selected sections with one of those options without having to go to tools->brushing->create new variable and then assign each variable 1 at a time?
Calabrese
Calabrese 2015년 7월 27일
I have used this feature for an individual plot but my data comes back empty
figure(3)
x = plot(Time,CMP1,'m')
title('CMP1')
axis([min(Time),max(Time),4.7,5.3])
brush on
pause
hB = findobj(x,'-property','BrushData');
a = set(hB,'BrushData', 'YourNewValues')
b = get(hB,'BrushData');

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by