Control Gui with another Gui
2 views (last 30 days)
Show older comments
I would like the handles of a GUI into another GUI. I did this with the method described below, where I use the matlab function in another script. Only the handles are herein not found. Probably because the handles can not be called in the other matlab script.
Script which calls the other function
function Omhoog5Links_Callback(hObject, eventdata, handles)
% hObject handle to Omhoog5Links (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = 'Omhoog5Links'
setappdata(0, 'kalibratie', handles)
kalibreren = getappdata(0, 'kalibreren')
feval(kalibreren)
The Function which is called
function Kalibratieframe(hObject, eventdata, handles)
% hObject handle to Kalibratieframe (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
findObj(Hoogtefilmpjebeamer, 'type', 'figure')
h=getappdata(0, 'kalibratie')
switch h
case 'Omhoog5Links'
h = get(handles.Kalibratieframe, 'Position')
i = h+[0 -5 0 0]
set(handles.Kalibratieframe, 'Position', i)
The function is saved by in OpeningFcn
setappdata(0, 'kalibreren', @Kalibratieframe)
0 Comments
Answers (2)
Babak
on 12 Dec 2012
I think you need to remove the line
handles = 'Omhoog5Links'
because handles includes all the data of the GUI and you are simply over-writing it with a string. You are clearing all the handle data with this line and all what is written in setappdata(0, 'kalibratie', handles) as for the value of the data is a string that is passed.
0 Comments
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!