How to make a callback from a pushbutton to a figure in MATLAB?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Geoff Hayes
el 14 de Ag. de 2019
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.
Respuestas (0)
Ver también
Categorías
Más información sobre Environment and Settings 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!