From: us on 20 Jun 2010 10:43 Adam Chapman > Ive tried: > h=setappdata(0,'V',V) and h=set(0,'V',V) > > but to no avail. well... of course, this does CANNOT work - and the syntax is wrong, to boot... did you carefully look at what i've shown to you(?)... did you, by any chance, see that i used something like ...'userdata'... in the SET example did you peruse the HELP/DOC(?)... did you look at the ...siblings... of SETAPPDATA, in particular: GETAPPDATA... did you do anything like that(?)... us
From: Adam Chapman on 20 Jun 2010 11:11 Im sorry, Im not trying to annoy you but I actually dont understand this. I have looked at the help and understand that 'userdata' can be any name you want to call your variable that you want to transfer. Now in the help the format is specified: setappdata(h,'name',value) Where h is a handle to an object. I guess you would make a handle to an object called 'userdata'. so now my code snippet in the GUI looks like this: h=set(0,'data'); setappdata(h,'data',V); now I supose the function getappdata is called from the command window? However the handle h isn't accessible in the command window. Now my brain hurts!
From: us on 20 Jun 2010 11:29 Adam Chapman <adamchapman1985(a)hotmail.co.uk> wrote in message <a6463f72-e9ac-4660-8085-939c9512d342(a)k39g2000yqd.googlegroups.com>... > Im sorry, Im not trying to annoy you but I actually dont understand > this. > > I have looked at the help and understand that 'userdata' can be any > name you want to call your variable that you want to transfer. > > Now in the help the format is specified: > setappdata(h,'name',value) > > Where h is a handle to an object. I guess you would make a handle to > an object called 'userdata'. > > so now my code snippet in the GUI looks like this: > > h=set(0,'data'); > setappdata(h,'data',V); > > now I supose the function getappdata is called from the command > window? However the handle h isn't accessible in the command window. > Now my brain hurts! oh well... NO... you REALLY should read the get-started docs, which are very well written... 1) 'userdata' is the common(!) property name for a graphics obj, eg, a figure, axis, line, etc... thus, the syntax ALWAYS follows this - exemplary - logic oh=line; % <- or any other object handle... set(oh,'userdata',{magic(3),'foo'}); % then, later on (as long as you have access to OH[!])... ud=get(oh,'userdata'); 2) SET-/GET- APPDATA typically are used like this % in your function, eg, a callback... setappdata(0,'thisdata',{magic(3),'foo'}); % <- we use the root's container! % then, later on in anoter function or the command window... ud=getappdata(0,'thisdata'); % note: the root's handle (0) can be replaced by any other OH - as shown above... us
From: Adam Chapman on 20 Jun 2010 12:10 On Jun 20, 4:29 pm, "us " <u...(a)neurol.unizh.ch> wrote: > Adam Chapman <adamchapman1...(a)hotmail.co.uk> wrote in message <a6463f72-e9ac-4660-8085-939c9512d...(a)k39g2000yqd.googlegroups.com>... > > Im sorry, Im not trying to annoy you but I actually dont understand > > this. > > > I have looked at the help and understand that 'userdata' can be any > > name you want to call your variable that you want to transfer. > > > Now in the help the format is specified: > > setappdata(h,'name',value) > > > Where h is a handle to an object. I guess you would make a handle to > > an object called 'userdata'. > > > so now my code snippet in the GUI looks like this: > > > h=set(0,'data'); > > setappdata(h,'data',V); > > > now I supose the function getappdata is called from the command > > window? However the handle h isn't accessible in the command window. > > Now my brain hurts! > > oh well... > NO... > you REALLY should read the get-started docs, which are very well written.... > > 1) 'userdata' is the common(!) property name for a graphics obj, eg, a figure, axis, line, etc... > thus, the syntax ALWAYS follows this - exemplary - logic > > oh=line; % <- or any other object handle... > set(oh,'userdata',{magic(3),'foo'}); > % then, later on (as long as you have access to OH[!])... > ud=get(oh,'userdata'); > > 2) SET-/GET- APPDATA typically are used like this > > % in your function, eg, a callback... > setappdata(0,'thisdata',{magic(3),'foo'}); % <- we use the root's container! > % then, later on in anoter function or the command window... > ud=getappdata(0,'thisdata'); > % note: the root's handle (0) can be replaced by any other OH - as shown above... > > us- Hide quoted text - > > - Show quoted text - Thankyou, that was a big help. Is there any way to actually force the data into the normal workspace though without having to call it in?
From: Adam Chapman on 20 Jun 2010 12:13 On Jun 20, 5:10 pm, Adam Chapman <adamchapman1...(a)hotmail.co.uk> wrote: > On Jun 20, 4:29 pm, "us " <u...(a)neurol.unizh.ch> wrote: > > > > > > > Adam Chapman <adamchapman1...(a)hotmail.co.uk> wrote in message <a6463f72-e9ac-4660-8085-939c9512d...(a)k39g2000yqd.googlegroups.com>... > > > Im sorry, Im not trying to annoy you but I actually dont understand > > > this. > > > > I have looked at the help and understand that 'userdata' can be any > > > name you want to call your variable that you want to transfer. > > > > Now in the help the format is specified: > > > setappdata(h,'name',value) > > > > Where h is a handle to an object. I guess you would make a handle to > > > an object called 'userdata'. > > > > so now my code snippet in the GUI looks like this: > > > > h=set(0,'data'); > > > setappdata(h,'data',V); > > > > now I supose the function getappdata is called from the command > > > window? However the handle h isn't accessible in the command window. > > > Now my brain hurts! > > > oh well... > > NO... > > you REALLY should read the get-started docs, which are very well written... > > > 1) 'userdata' is the common(!) property name for a graphics obj, eg, a figure, axis, line, etc... > > thus, the syntax ALWAYS follows this - exemplary - logic > > > oh=line; % <- or any other object handle... > > set(oh,'userdata',{magic(3),'foo'}); > > % then, later on (as long as you have access to OH[!])... > > ud=get(oh,'userdata'); > > > 2) SET-/GET- APPDATA typically are used like this > > > % in your function, eg, a callback... > > setappdata(0,'thisdata',{magic(3),'foo'}); % <- we use the root's container! > > % then, later on in anoter function or the command window... > > ud=getappdata(0,'thisdata'); > > % note: the root's handle (0) can be replaced by any other OH - as shown above... > > > us- Hide quoted text - > > > - Show quoted text - > > Thankyou, that was a big help. > > Is there any way to actually force the data into the normal workspace > though without having to call it in?- Hide quoted text - > > - Show quoted text - Neever mind, found it: assignin does the trick Thanks again for your help us, I appreciate your time
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: GUI mouse motion over figure Next: Help to calculate time complexity of a program |