MATLAB Answers

Toolbar Guide GUI Editor - Tool Creation - Brush

22 views (last 30 days)
William
William on 4 Mar 2015
Answered: Sung Hwan Heo on 18 Mar 2016
How can I include a brush tool onto my GUI? This is as far as I get
function uitoggletool_ClickedCallback(hObject, eventdata, handles)
brush(handles.clean_plot)
guidata(hObject, handles)
Many thanks, Will

  0 Comments

Sign in to comment.

Accepted Answer

Adam
Adam on 5 Mar 2015
Edited: Adam on 5 Mar 2015
function togglebutton1_Callback(hObject, eventdata, handles)
if hObject.Value == 1
brush( handles.figure1, 'on' );
else
brush( handles.figure1, 'off' );
end
seems to work fine for me using a toggle button. Strangely when I tested it at first on a scatter plot using the '*' marker it didn't work, but the same behaviour happened when I just tried on a normal normal figure so I don't know what is going in there. It worked when I used a 's' marker for my scatter plot though in both cases.
handles.figure1 is the tag for the figure itself. I never call mine 'figure1' when i am creating a proper GUI, but this was just a test so that is what it refers to. It must be the figure handle, not an axes handle.

  10 Comments

Show 7 older comments
Adam
Adam on 6 Mar 2015
You can either create a new figure or use the figure containing your current axes handle. So long as you have the handle of whichever figure it is to be applied to it should work.
William
William on 6 Mar 2015
Because I have 2 other axes handles within this figure, so how to I choose a specific axes?
Think I'll just define a new figure and then save the brush data into the workspace shared by the original figure
Adam
Adam on 6 Mar 2015
As far as I know the brush will apply to all axes in a figure. I don't see an option to choose an axes for the brushing specifically. It isn't functionality I have ever used myself though, I'm just looking at the help page.

Sign in to comment.

More Answers (1)

Sung Hwan Heo
Sung Hwan Heo on 18 Mar 2016
Do as follows//
function uitoggletool_brush_ClickedCallback(hObject, eventdata, handles)
if strcmp(get(handles.uitoggletool_brush, 'state'), 'on') brush( handles.figure1, 'on' ); else brush( handles.figure1, 'off' ); end guidata(hObject, handles);

  0 Comments

Sign in to comment.

Sign in to answer this question.


Translated by