Info
此问题已关闭。 请重新打开它进行编辑或回答。
uicontrol and data sharing
1 次查看(过去 30 天)
显示 更早的评论
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= ?????
0 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!