get variables from one file to mainfunction in gui

2 ビュー (過去 30 日間)
ram
ram 2011 年 7 月 8 日
Hi, i have main function in m.file, i want to callback some variables in main function that in the form of another m.file. how can i callback that m.file variables in main function, i used guidata(hObject,handles) it displays ??? Error using ==> popupmenu_Callback Too many output arguments.
Error in ==> SERC>popupmenu_Callback at 131 handles.popupmenu_callback = popupmenu_callback
Error in ==> gui_mainfcn at 97 feval(varargin{:});
Error in ==> SERC at 42 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)SERC('popupmenu_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
what is the error in that....

回答 (1 件)

Bob Hamans
Bob Hamans 2011 年 7 月 8 日
Just pass the variables between your function as an argument if you do not need intermediate action/calculation.
outvarfunc1 = func1(invarfunc1); outvarfunc2 = func2(outvarfunc1);
Or try to make use of the function assignin to assign a value to variable in a specified workspace of a caller function.
assignin('caller', 'invarfunc2', outvarfunc1);
Or if you want to get really dirty use a global variable.
global varinouteverywhere;

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by