Use data in other functions

hi, i made a project that pass data, seven variables, from an editbox(subgui) to an textbox(maingui). i need to use that data in a pushbutton functions that runs a script that needs those values:
S.ed = uicontrol('style','text',...
'units','pix',...
'position',[50 470 101 31],...
'string','B.');
function [] = pb_call(varargin)
% Callback for pushbutton.
S = guidata(gcbf); % Get the structure.
set(0,'userdata',S); % Save it in the root.
f = make_subgui;
set(S.fh,'deletefcn',{@fig_delet,f})
function [] = B_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
and the script in a pushbutton for exemple is: ... B=10; C=20; ...
i want to change those values to the values from the subgui.i need to use this in subgui?
set(xxxx,'string',get(gcbo,'string'))
what i need to put in xxxx? the function name from the script?

 Akzeptierte Antwort

Daniel Shub
Daniel Shub am 21 Sep. 2011

0 Stimmen

I don't quite under stand your question. I am guessing the function make_subgui mkaes your subgui and returns its handle (f in the pb_call function). I think you want to save "f" someplace (possibly in the root). Then you can simply do:
set(f,'string',get(gcbo,'string'))
where f is the handle to the object you want to set.

3 Kommentare

Nu9
Nu9 am 21 Sep. 2011
correct, it's that waht i want and then i want to use all the values from the editbox(at subgui) in other pb_script function. exemple:
@ Subgui- i insert A B C D(i return as you say this values to pb_call.
Then
@ pb_script- i want o use the values from subgui too,i've declared A=1,B=2,C=3,D=4 and then i want to use the new values and replace the old values.
Daniel Shub
Daniel Shub am 21 Sep. 2011
So did I answer your question or not? I still do not know how you are generating your gui's and what the handles to all the objects are.
Nu9
Nu9 am 22 Sep. 2011
i use matt fig's GUI 24 to begin.
1-in my sub gui i can input values(A,B,C...)
2- i want to use the values from subgui in: a staticbox and a program that needs those values to run.
3- in a push button(pb_script) i've that program(A,B,C.. each equal to zero) and i want to use the values from the subgui
can i do like this in pb_script:
A=S.ed (following the code above)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by