Filter löschen
Filter löschen

Control Gui with another Gui

1 Ansicht (letzte 30 Tage)
Joep
Joep am 11 Dez. 2012
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)

Antworten (2)

Image Analyst
Image Analyst am 12 Dez. 2012

Babak
Babak am 12 Dez. 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.

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by