Thank you for writing us about your problem with using GNU Octave. To help us help you, please answer the following questions, if applicable.
I updated my Octave installation from 6.4 to 7.2 and an application I developed some time ago gives an error indicationg I have too many inputs to an object. This does not happen on 6.4.
Has anyone else had a similar issue? If so can they help me to overcome this issue?
- OS:Windows 10 64bit
- Octave version: Version 7.2
- Installation method: Downloaded and installed “octave-7.2.0-w64-installer.exe” from Download**
Can you provide more specifics about what this object is, how you’re calling it that triggers the error, and what is the exact error message?
In Octave 7 it has become an error to call a function with too many input arguments, e.g. the following anonymous function accepts 2 arguments and if I provide 3 I’ll get an error:
octave:1> fcn = @(x,y) x+y;
octave:2> fcn (1,2,3)
error: @<anonymous>: function called with too many inputs
error: called from
You should probably look for any such inconsistency in your code
Thanks for the prompt reply. I will follow the code through to trace the fault.
After investigating this problem it seems the issue is with calling encapsulated class methods.
I have included a cut down test app which illustrates the problem.
From the inialisation I call an object loadMyData.
Previously, with 6.4 the call was obj.loadMyData(obj) which gave the" too many inputs" error in 7.2.
I have changed that to loadMyData(obj) which appears to work OK.
The alternative, which also appears to work, is obj.loadMyData().
It seems that making the call using an object pointer or passing the pointer as a parameter are both considered as inputs, hence the input duplication.
Before I go ahead and change all the calls to the class methods, which are quite a few, can you confirm I have understood the situation correctly?
test.m (73 Bytes)
gui.m (1019 Bytes)
object.m (4.39 KB)
You can safely change all uses of
obj.loadMyData() (or equivalently
loadMyData(obj)) and that will work in both Octave 6.2 and 7.2.
obj.method () is equivalent to
method (obj), so calling
obj.method (obj) is equivalent to
method (obj, obj). If
method only expect 1 obj argument, you’ll get the
function called with too many inputs error.
OK. Thanks for that.
Another issue I found was that callback functions now have to have handle and event specified in the parameter list. With 6.4 this wasn’t needed.
Finally the 7.2 installer hangs when finishing and corrupts the OS thus requiring a restart. Not a serious problem but not a good look, especially if it’s someone new to Octave.