Control Gui with another Gui
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Babak
2012-12-12
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!