From: Matt J on 8 Feb 2010 13:33 "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hkpkd4$2e0$1(a)fred.mathworks.com>... > Peter <petersamsimon2(a)hotmail.com> wrote in message <6a8e4b21-8a4b-49f9-8e36-7bf5ecd60826(a)b7g2000yqd.googlegroups.com>... > > > Since the two handles do not point to the > > same regions of memory, they are therefore considered not equal. > ================ > > That doesn't quite rationalize it for me. ISEQUAL is supposed to examine the contents of the variables, not just the region of memory they occupy. In the following simple example, a and b do not point to the same memory either, yet isequal correctly judges they as equal. > > >> a=1;b=1; isequal(a,b) > > ans = > > 1 Or do you mean that a value variable, like a=1 and b=1, is a copy-on-write pointer to a piece of data whereas a handle variable is a copy-on-write pointer to another pointer? That would explain it, I suppose...
From: Matt J on 8 Feb 2010 13:51
Just to add to the mix, the same phenomenon occurs for nested functions as for anonymous functions: function h=test h=(a)nested; function out=nested out=1; end end >> isequal(test,test) ans = 0 |