Info

この質問は閉じられています。 編集または回答するには再度開いてください。

uicontrol and data sharing

1 回表示 (過去 30 日間)
Nu9
Nu9 2011 年 9 月 22 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by