"SK " <email@example.com> wrote in message <firstname.lastname@example.org>... .... > > s = strange(1,2,3); > --- can edit x, y and z in variable editor. > > s = s.SetF(@sin); > ---- now cannot edit either x, y or z in variable editor. > > s = s.SetF(); > ---- editing re-enabled ---- > > s = s.SetF(2); > ---- no problem--- > > Why?
Looks like it is a problem with overloading the 'display' method for double. To reproduce the problem, create the class as above and create a folder @double with an overloaded display method. There is an attempt to call 'display' internal to matlab - not sure from which route, but the debugger gets to it at the end of an if - end block. The moment I removed the overloaded method everything was fine.
I had this problem earlier with overloading 'display' for char. I did this in order to have a convenient switch to turn off command line output. Every time I tried to open an m-file via the current folder window, an error would be generated: 'Undefined Command 'display'. ". It turned out there there is a matlab file mopen.m which calls edit(filename) - without a terminating semicolon. This was generating a call to @char\display and for some reason 'display' could not be found. Since 'edit' returned just a boolean value, I simply added the terminating semicolon to edit(filename) and this solved the problem.
I suspect the explanation in the @double case is similar but in this case display seems to be getting called at the end of an if-end block, so I'm not able to spot where the call is coming from. Any experts can comment?