Save and restore state for a deployed application
Afficher commentaires plus anciens
I am using this method : http://blogs.mathworks.com/videos/2010/12/10/how-to-save-and-restore-state-of-a-gui-in-matlab/ to save and restore the last state of my gui.
Specifically everytime the gui close it saves a .mat file and when it opens the next time it loads the .mat file. However when I deploy the GUI into a standalone application, there is an error. I can't even close my application.
This is my save state Function:
function saveState(handles,fileName)
state.Items_Detail = get(handles.Items_Detail, 'Data');
state.Recipt_Num_val = get(handles.Recipt_Num_val, 'string');
if exist(fileName,'file')
fileNamewithPath=which(fileName);
save(fileNamewithPath,'state')
else
save(fileName,'state')
end
and my Loadstate Function:
function loadState(hObject,handles,fileName)
if exist(fileName,'file')
load(fileName)
set(handles.Items_Detail, 'Data' ,state.Items_Detail);
set(handles.Recipt_Num_val, 'string' ,state.Recipt_Num_val);
guidata(hObject,myhandles)
delete(fileName)
else
return;
end
Is there just solely because of the path problem or the deployed app can't write and modify a .mat file? Can anyone gives me a suggestion what I could do?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur MATLAB Compiler dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!