I have a GUI made in GUIDE. I need to store some data within functions and they must be reachable by other callbacks. I am using guidata like the following:
function MyFunction(input1,input2,...,inputN) MyData = CalculateMyData(inputs); handles.DataToSave = MyData; guidata(gcf(),handles) end
Later in another Callback I'm trying to get back the data and save it to a file like the following:
function SaveData(handles) SavedData = handles.DataToSave; dlmwrite(MyFile,SavedData,'\t') end
However, the field DataToSave no longer exists. I know that the handles and the guidata are not the same structure, therefore I tried the following code as well:
function SaveData(handles) MyGUIData = guidata(gcf()); SavedData = MyGUIData.DataToSave; dlmwrite(MyFile,SavedData,'\t'); end
Unfortunately this code does not work either. How can I solve this problem? Any help is appreciated. László
Best Answer