Borrar filtros
Borrar filtros

button in a figure

16 visualizaciones (últimos 30 días)
Dimitrios
Dimitrios el 3 de Jun. de 2014
Respondida: David Sanchez el 5 de Jun. de 2014
How to add a button in a figure that changes the line style of a subplot,without using GUIDE?
  1 comentario
the cyclist
the cyclist el 3 de Jun. de 2014
Maybe I misunderstand, but isn't a button that a user pushes, by definition, a graphical user interface?

Iniciar sesión para comentar.

Respuestas (1)

David Sanchez
David Sanchez el 5 de Jun. de 2014
try this:
S.f = figure; S.h=plot(rand(10,1)); % creates a figure and plot something on it
% create a pushbtton ( adapt it to your needs)
S.pb = uicontrol('style','push',...
'units','pix',...
'position',[10 10 180 40],...
'fontsize',14,...
'string','Change line',...
'callback',{@pb_call,S});
%callback function for the pushbutton (save it in its own *.m file if needed)
function pb_call(varargin)
S = varargin{3}; % Get the structure.
set(S.h,'LineStyle','+')

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by