help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

nargin for methods


From: jjg
Subject: nargin for methods
Date: Tue, 18 Jul 2017 13:12:49 -0700 (PDT)

Hi all,

I have a stable library (MVPoly in case anyone is interested,
http://soliton.vm.bytemark.co.uk/pub/jjg/en/code/mvpoly/) which defines a
classdef-style class with all the methods in a @ directory, those methods
have their signatures in the classdef file.  All is well with that.

I have some unstable code which I'd like to add to the library locally.  I
create a package with a different name but with the same name for the @
directory and put my new method in there.  

  function [M, v, nevals] = unstable(p, other, args)
    yada yada

This new method is accessible from instances of the class, I can do 

  p = MVPoly()
  M = p.unstable()

and that works, but, if I try

  [M, v, nevals] = p.unstable()

I get

  error: element number 2 undefined in return list

and indeed, if I put some debugging code in my unstable method, nargin is
always 1, no matter how many out-arguments are present.  I suspect that this
is because my unstable method does not have a signature in the stable
library classdef file, but if I add one then the behaviour stays the same. 
I then suspect that the "scope" of the signature does not extend to my
second @ directory and I start to run out of ideas.

So does anyone have an idea as to how I could add a method with multiple
return values to an existing class without integrating the code into that
class, "re-open" the class to add methods if you will.  I suspect this is
not possible but I'd be grateful if someone could confirm that (and
delighted if there is some kind of trick possible)

Cheers

Jim



--
View this message in context: 
http://octave.1599824.n4.nabble.com/nargin-for-methods-tp4684151.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]