get variables from one file to mainfunction in gui

조회 수: 3 (최근 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 CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by