Same script - 2 pcs - error on one PC only with setappdata

Hi, I made a gui which shares data via setappdata/getappdata. Everything works like charm, but when I send it to my friend (m-files), it always says invalid handle object in one of the setappdata lines. I store data in root and in main gui and I call it via main handles stored in root.
Only he has the error message, could it be because he has 64-bit version ( I have 32)? Or the root itself is a problem?
I havent find any answers so far.
Edit: To be completely clear, it worked for him few days ago even when he wrote some application with it. Now every setappdata gets him invalid object handle, even in a script that he used and worked( wasnt changed btw) Thanks!

3 Comments

Please post the failing code. Otherwise an answer is guessing only.
ok, so in the main gui in opening function I defined:
function gui_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
setappdata(0 , 'hMainGui' , gcf);
setappdata(gcf,'updateData', @updateData);
Then in the import gui, whick I open through main gui, I have on Ok press:
function push_ok_Callback(hObject, eventdata, handles)
hMainGui = getappdata(0, 'hMainGui');
setappdata(hMainGui,'impData',get(handles.table_import,'data'));
setappdata(hMainGui,'impName',get(handles.editName,'String'));
updateData = getappdata(hMainGui,'updateData');
feval(updateData);
gui_import('push_cancel_Callback',hObject,eventdata,guidata(hObject))
A while back without changing a thing it wrote him an error with feval.
It didn't read the updateData from getappdata :/
This is the error for him, even thou it still works for me.
??? Error using ==> setappdata
Invalid object handle
Error in ==> gui_import>push_ok_Callback
at 229
setappdata(hMainGui,'impData',get(handles.table_import,'data'));
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> gui_import at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)gui_import('push_ok_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback

Sign in to comment.

Answers (1)

setappdata saves the data in a user file. Perhaps removing that file (might want to rename it) would help.

3 Comments

You mean like another file in the folder with the script? Nothing was created and if u meant the file itself it didn't work.
SETAPPDATA does not write to a file.
Ah yes, Jan is correct. I was thinking of setpref()

Sign in to comment.

Asked:

on 3 Apr 2012

Community Treasure Hunt

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

Start Hunting!