hi,
i took a look on google and also matlab help but i gave up
finished with a total mess in my head:/
can anyone describe me how i can send arguments between
functions in GUI?
i've got smth like that:
3 functions (separate m-files). 'gui' is the main file, in
witch i've got 2 buttons.
if i click on the first one another function will be
called, and this functions should return arguments (few) to
the main program, 'gui'. then, if i click the second
button, the third function will be called and these
arguments should be send to it..
"misty m." <donotspam@smth.be> wrote in message
<g0buqd$omg$1@fred.mathworks.com>...
> hi,
> i took a look on google and also matlab help but i gave up
> finished with a total mess in my head:/
>
> can anyone describe me how i can send arguments between
> functions in GUI?
>
> i've got smth like that:
> 3 functions (separate m-files). 'gui' is the main file, in
> witch i've got 2 buttons.
> if i click on the first one another function will be
> called, and this functions should return arguments (few) to
> the main program, 'gui'. then, if i click the second
> button, the third function will be called and these
> arguments should be send to it..
>
> i hope i wrote clearly what my problem is.
>
> kind regards,
> misty
Hai,
Tryout the following,
GUI.m
function Button1_Callback(hObject, eventdata, handles)
global out1 out2 ....
[out1,out2..] = m_file1(arg1,arg2...)
function Button2_Callback(hObject, eventdata, handles)
global out1 out2 ....
[out11,out12..] = m_file2(out1,out2,....)
Hope this will help u .. if not clear.. plz get back
i gave up and i tried to do GUI using GUIDE, not manualy as
i tried before.
but still i do not know how to send arguments between
callback functions or values from
edit field..
can anyone explain my simply how to use these 'handles' to
send/get things between m-files
or functions?
You can associate data with object using "setappdata" and
"getappdata". But since you are designing a GUI, then
associating the data to be shared to the figure itself is
the easiest way.
eg.
function send()
guiFigure = figure;
A = 1:100;
B = sin(A);
handles.A = A;
handles.B = B;
guidata(guiFigure, handles);
end
function receive(hObject, eventdata)
handles = guidata(guiFigure);
A = handles.A;
B = handles.B;
This is really easy!
"misty m." <donotspam@smth.be> wrote in message
<g0buqd$omg$1@fred.mathworks.com>...
> hi,
> i took a look on google and also matlab help but i gave up
> finished with a total mess in my head:/
>
> can anyone describe me how i can send arguments between
> functions in GUI?
>
> i've got smth like that:
> 3 functions (separate m-files). 'gui' is the main file, in
> witch i've got 2 buttons.
> if i click on the first one another function will be
> called, and this functions should return arguments (few) to
> the main program, 'gui'. then, if i click the second
> button, the third function will be called and these
> arguments should be send to it..
>
> i hope i wrote clearly what my problem is.
>
> kind regards,
> misty
Tags for this Thread
Add a New Tag:
Separated by commas
Ex.: root locus, bode
What are tags?
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.
Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central. Read the complete Disclaimer prior to use.