Is it possible to add Plot Edit Toolbar functionality to a GUI?

5 visualizaciones (últimos 30 días)
I am creating a data visualization GUI, and I'd like to add the ability for the users to annotate the plots as they wish. The 'Plot Edit Toolbar' menu option would be perfect.
Any help would be appreciated!

Respuesta aceptada

Patrick Kalita
Patrick Kalita el 12 de Jul. de 2011
Well, this is a little sneaky, but you can try this if you absolutely need to have this functionality. First, you can find the menu item with the "Plot Edit Toolbar" label and look at it's Callback property:
f = figure;
M = findall(f, 'Label', '&Plot Edit Toolbar');
get(M, 'Callback')
Now that you know what it's doing, you can call the same function that its using in your GUI.
I think we're getting into somewhat "undocumented" functionality here, so the standard warning about that (functionality could change in a future release without warning, etc.) applies here.
  5 comentarios
Jan
Jan el 12 de Jul. de 2011
The profiler can help to find the applied callback. Start the profile, hit the menu function, inspect the profiler report for the used functions.
=> plotedit(FigH, 'plotedittoolbar', 'toggle')
Fangjun Jiang
Fangjun Jiang el 13 de Jul. de 2011
Thanks, Patrick. The reason I am asking is to see if there is an hidden API to use the interactive Brush functionality. Do you see a possibility? See this post. http://www.mathworks.com/matlabcentral/answers/11439-selecting-data-from-a-plot-in-a-gui

Iniciar sesión para comentar.

Más respuestas (1)

Jan
Jan el 11 de Jul. de 2011
The toolbar of a figure is disabled, if an UICONTROL is created. But you can enable it manually:
figure('Toolbar', 'figure');
uicontrol('Style', 'Pushbutton');
Or if you use GUIDE to create the figure, you can enable the toolbar in the CreateFcn also.
  6 comentarios
mechE
mechE el 19 de Jun. de 2019
Please post the solution
Lucie S.
Lucie S. el 11 de Feb. de 2020
Editada: Lucie S. el 11 de Feb. de 2020
This is working for me. In your guide, right click on your figure (outside the plots)--> view callbaks--> Create Fcn. Then in the function created in your .m file add the code as below:
%%%%%
function figure1_CreateFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
set(hObject ,'Toolbar','figure');
%%%%%
This sentence also works (I don't see the difference): set(hObject,'Menubar','figure');

Iniciar sesión para comentar.

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by