Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with calling function; too many outputs #275

Closed
mludwini opened this issue Nov 16, 2022 · 1 comment
Closed

Problem with calling function; too many outputs #275

mludwini opened this issue Nov 16, 2022 · 1 comment

Comments

@mludwini
Copy link

mludwini commented Nov 16, 2022

Hi, after I updated Octave from 6.4 to 7.2 I get an error while trying to call function:

octave.in_data_gen(a, 'A.txt', L, N)

Output:

  File "/home/vm/.local/lib/python3.11/site-packages/oct2py/dynamic.py", line 103, in __call__
    return self._ref().feval(self.name, *inputs, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vm/.local/lib/python3.11/site-packages/oct2py/core.py", line 392, in feval
    return self._feval(func_name, func_args, dname=dname, nout=nout,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vm/.local/lib/python3.11/site-packages/oct2py/core.py", line 595, in _feval
    raise Oct2PyError(msg)
oct2py.utils.Oct2PyError: Octave evaluation error:
error: in_data_gen: function called with too many outputs
error: called from:
    in_data_gen at line -1, column -1

The function was working fine before the update and is working fine when being used in Octave directly. Function is very simple, doesn't return anything; only does some type cating and writes a txt file.

I've done some more testing and the problem only occurs when the function matlab function called by oct2py does not return any value. When the same function is modified to return some value everything works fine.

@mludwini mludwini changed the title Problem with Problem with calling function; too many outputs Nov 16, 2022
@mludwini
Copy link
Author

Ok, I've been able to fix the issue by adding an additional argument when calling function nout=0. Presumably I should have thought about it earlier. Sorry for making fuss. Hope that this will help anyone migrating their code to newer version of octave.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant