Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

uicontrol and data sharing

1 vue (au cours des 30 derniers jours)
Nu9
Nu9 le 22 Sep 2011
Clôturé : MATLAB Answer Bot le 20 Août 2021
hi i use matt fig's GUI 24 to begin my program where i've: main gui with seven textbox,a pb_subgui that opens subgui where i input values(A,B,C...)in seven editbox and another pb2 to run a program.
in hte program : 1- i want to use the values from subgui in: a staticbox and a program that needs those values to run. 2- in a push button at maingui(pb2) i've that program and i want to use the values from the subgui and set A=(A from subgui)
can i do like this in pb_script: A=S.ed or A=getappdata(s.ed,'string')
S.ed = uicontrol('style','text',...
'units','pix',...
'position',[50 470 101 31],...
'string','A.');
S.pb2 = uicontrol('style','pushbutton',...
'units','pix',...
'position',[170 620 80 31],...
'string','Executar',...
'callback',{@pb2_call,S});
function [] = A_call(src,evendata)
% Callback for secondary GUI editbox.
S = get(0,'userdata');
%set(S.ed,'string',get(gcbo,'string')) % Set gui_passdata editbox string.
str=get(src,'string');
if (isempty(str2num(str)))
set(src,'String','0')
errordlg('Por favor só numeros','Erro','modal')
else
set(S.ed,'string',get(gcbo,'string')) % Set gui_passdata editbox string.
end
function [] = pb2_call(varargin)
% Callback for GUI_24 pushbutton.
clc; % clear comand window
%S = guidata(gcbf); % Get the structure
S = varargin{3};
set(0,'userdata',S);
A= ?????

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by