How to use Setappdata/ Getappdata
Show older comments
Hello, I already found few Questions concerning my question but it does not help me. So what is the problem: I designed two GUI and I would like to make it work if you are changing the name of a pushbutton (used like a tab), in the second GUI it should change the name as well.
So, I already tried:
% --- Executes on button press in pushbutton31. function pushbutton31_Callback(hObject, eventdata, handles) % hObject handle to pushbutton31 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) Tabname= get(handles.pushbutton8, 'String'); Daten= getappdata(handles.figure1, Tabname);
-> which means (to me), MatLab will store Tabname of figure 1.
Now, I am changing from GUI1 to GUI2, mfile changes as well.
% --- Executes on button press in pushbutton31.
function pushbutton31_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton31 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
setappdata(handles.figure1, 'Daten', Tabname)
-> with this, I am taking the stored data from figure1 and I am calling especially Tabname.
But it does not work in general. I guess I have a basic problem with the notation or a definition is missing. I am receiving following error message: Undefined function or variable 'Tabname' or Reference to non-existent field. Is there anyone who can explain me how to use this commands right? Or should I use other commands?
I am thankful for every advice.
Answers (1)
Felix Oestrech
on 27 Aug 2018
Categories
Find more on Title 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!