Handle to a non-static method

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Handle to a non-static method

Andres Felipe Acosta Gil
Dear Octave community.

I am trying to obtain a handle to a non-static method of a class which has been implemented with classdef. How can I achieve this in Octave?, I have verified that it can be done in Matlab. I also tried the workarounds suggested in https://wiki.octave.org/Classdef, with no success. I got, among others, the error "error: method `foo' is not static".

Thanks in advance!

--
Andres Felipe Acosta Gil, MSc student - Software developer
Universidad Nacional de Colombia - MedellĂ­n
Facultad de Minas
Tel: +57 (4) 4255092
Institutional e-mail: [hidden email]



_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Handle to a non-static method

Mike Miller-4
On Wed, Jun 21, 2017 at 12:55:55 -0500, Andres Felipe Acosta Gil wrote:
> I am trying to obtain a handle to a non-static method of a class which has
> been implemented with classdef. How can I achieve this in Octave?, I have
> verified that it can be done in Matlab. I also tried the workarounds
> suggested in https://wiki.octave.org/Classdef, with no success. I got,
> among others, the error "error: method `foo' is not static".

We would be able to help you better if you showed what you have tried.

The wiki suggests using an anonymous function, which works for me:

  fcn = @(obj, val) obj.some_method (val);

--
mike

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Loading...