How to make a callback from a pushbutton to a figure in MATLAB?
조회 수: 4 (최근 30일)
이전 댓글 표시
Hei,
I wanted to ask you guys how I do the callback from this pushbutton from the main interface:
%PushButton Vc
uicontrol('Style','PushButton',...
'Units','normalized',...
'BackgroundColor',[0.0,0.0,0.0],...
'FontSize',8,...
'FontWeight','b',...
'ForegroundColor','W',...
'FontName','Consolas',...
'String','Matrice codare [Vc]',...
'Position',[0.08,0.15,0.12,0.08]);
To when I push the button to show me this new figure ( The code for figure is in another file saved):
%Figura Codare TORNADO
%--------------------------------------------------------------------------
figure()
set(gcf,'color','Black'); %setare background
%'Elementele matricii de codare liniara Tornado [Vc]'
uicontrol('Style','Text',...
'Units','Normalized',...
'Position',[0.1,0.6,0.5,0.4],...
'BackgroundColor',[0,0,0],...
'FontSize',12,...
'ForegroundColor','White',...
'FontWeight','b',...
'FontName','Consolas',...
'String','Elementele matricii de codare liniara Tornado [Vc]');
%Tabloul de valori
uicontrol('Style','Edit','Units','Normalize','position',[.1,.5,.6,.4],...
'Max',2,'String',num2str(Vc),'FontName', 'Consolas');
Thanks, please help
댓글 수: 3
Geoff Hayes
2019년 8월 14일
Demeter - is FiguraVc.m a script or a function? If a script, try converting it into a function that you can call from your callback function. So like Adam indicated,
'Callback', @myFunction
where
function myFunction(~,~)
FiguraVc;
end
where I'm assuming that FiguraVc is the name of the function defined in the FiguraVc.m file.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!