필터 지우기
필터 지우기

button in a figure

조회 수: 16 (최근 30일)
Dimitrios
Dimitrios 2014년 6월 3일
답변: David Sanchez 2014년 6월 5일
How to add a button in a figure that changes the line style of a subplot,without using GUIDE?
  댓글 수: 1
the cyclist
the cyclist 2014년 6월 3일
Maybe I misunderstand, but isn't a button that a user pushes, by definition, a graphical user interface?

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

답변 (1개)

David Sanchez
David Sanchez 2014년 6월 5일
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','+')

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by