On Sep 15, 2011, at 7:42 AM, pantxo diribarne wrote:
> Hello list,
>
> I am currently writing a class using octave @folder framework.
> I need to use eval to access the fields of my object in the methods @myclass/get.m and @myclass/set.m but octave returns the same error as if I was trying to access the object fields from outside a method.
>
> In get.m :
> function varargout = get(p, arg)
> out = p.boardindex
> eval (["out = p." arg ";"]);
> varargout{ii} = out;
> endfunction
>
> Calling get with " get (obj, 'boardindex')", where obj is a 'myclass' object, I obtain :
>
> out = 2
> error: invalid index for class
> ...
>
> Is there a way to have eval function know that it is evaluated inside a method, or should I find the way not to use eval at all?
>
> Pantxo
The line below will throw an error.