1

This question is related to This Question.

I have followed the example from there:

t=0:0.2:25; plot(t,sin(t),'.-');
brush on
pause
hBrushLine = findall(gca,'tag','Brushing');
brushedData = get(hBrushLine, {'Xdata','Ydata'});
brushedIdx = ~isnan(brushedData{1});
brushedXData = brushedData{1}(brushedIdx);
brushedYData = brushedData{2}(brushedIdx);

However, findall(gca,'tag','Brushing') is empty. In fact, looking at the properties of gca, the label Tag is empty after setting brush on.

I have MATLAB 2016a and we have also tested MATLAB 2015a.

Does anyone know how to find the selected data?

Regards Erik

Community
  • 1
  • 1
El_Loco
  • 1,716
  • 4
  • 20
  • 35

1 Answers1

1

So the answer is here:

hLine = get(gca,'Children');
hBrushHandles = hLine.BrushHandles;
hBrushChildrenHandles = hBrushHandles.Children;  % Marker, LineStrip
hBrushChildrenHandles(1).VertextData

This is as I understand it from Matlab 2014 and onwards.

Regards Erik

Community
  • 1
  • 1
El_Loco
  • 1,716
  • 4
  • 20
  • 35