Questions tagged [oct2py]

Oct2Py is a Python library that allows the user to seamlessly call M-files and Octave functions from Python.

Oct2Py is a Python library which allows for seamless integration between Python and Octave. It manages the Octave session for you and transfers data between Python and the Octave session using MAT files.

Additionally, it provides OctageMagic which allows for integration of Oct2Py into Jupyter notebooks.

Example

from oct2py import Oct2Py

# Create an Octave session
oc = Oct2Py()

# Call an Octave function
x = oc.zeros(3, 3)

print(x, x.dtype)

#   [[ 0.  0.  0.]
#    [ 0.  0.  0.]
#    [ 0.  0.  0.]] float64

References

56 questions
2
votes
1 answer

get data from octave script execution using oct2py (python3)

I'm trying to execute some Matlab scripts (not a function definition) from Python 3 using oct2py module. Those scripts (a large amount) contains a very extended definition to read a specific ASCIII files (contained in the same directory). I do not…
Josep
  • 21
  • 1
  • 2
2
votes
2 answers

Running Octave tasks from Python

I have a pretty complex computation code written in Octave and a python script which receives user input, and needs to run the Octave code based on the user inputs. As I see it, I have these options: Port the Octave code to python. Use external…
Ohad
  • 1,450
  • 4
  • 18
  • 27
2
votes
1 answer

octave hangs in ipython

I don't seem to be able to get the octave magic running in ipython. I've installed gnu octave, and (after importing oct2py) I can use oct2py.octave in canopy. When I launch ipython and issue the command In [5]: %load_ext octavemagic I get a return…
Nesh
  • 21
  • 1
1
vote
1 answer

Delphi, Python4Delphi, Anaconda, Oct2Py, and Octave on Windows

I have a Delphi Win32 program that needs to run some scripts on Octave. I've taken the approach of going through Python4Delphi to get to a Python "environment", where I can write and run scripts that access Octave via Oct2Py. In order to get Oct2Py…
Bob
  • 587
  • 8
  • 17
1
vote
1 answer

python unable to unpack returned values from Octave function

I have a function called doFFT.m in Octave, defined as: function [Rx1,Rx2,fbins]=doFFT(file) this function runs as expected returning 3 row vectors. In Python, I have oct2py imported, from oct2py import octave and I call this Octave function…
jrive
  • 218
  • 2
  • 3
  • 14
1
vote
0 answers

Why does the Oct2Py session died?

I am running a code from Galí-Monacelli (2005) using dynare in Oc2py and the session dies. I tried running the driver.m from oc2py and I get the same error. Then I changed the timeout = None and timeout = 1e6 and the problem continues. If I run a…
Rene
  • 11
  • 2
1
vote
1 answer

Installed the oct2py package but is not recognized when imported

I have just installed the oct2py python package using the following command on my Windows: pip install oct2py However, whenever I try to import the package oct2py in my python script, I get the error: No module named "oct2py" What is it that is…
1
vote
1 answer

Returning class object from Oct2Py

I'm trying to run a basic MATLAB script that defines a class, and get that class object returned to python. I don't know MATLAB well, and am very new to Oct2Py so I may be completely misunderstanding how to do this. Any help would be greatly…
Novice
  • 855
  • 8
  • 17
1
vote
1 answer

Oct2Py gives "TypeError: cannot unpack non-iterable float object" with Psychtoolbox function returning multiple arguments

I am running a very basic Psychtoolbox example from their site using Oct2py package and I am facing an issue that is happening when I am trying to return two float values for that it looks like: from oct2py import octave import sys def ptb(): #…
theEarlyRiser
  • 134
  • 12
1
vote
0 answers

Oct2PyError: Octave evaluation error: error: invalid call to script

I'm trying to run matlab code in python. For this reason, I installed the oct2py to read a .m script file from Spyder. The script file (Enhance.m) contains some functions. When I try to invoke this script file, it returns: Oct2PyError: Octave…
melburmer
  • 11
  • 3
1
vote
1 answer

Octave isnan: not defined error using oct2py

Using oct2py to call corrcoef.m on several (10MM+) size dataframes to return [R,P] matrices to generate training sets for a ML algorithm. Yesterday, I had this working no problem. Ran the script from the top this morning, returning an identical…
broseidon
  • 85
  • 1
  • 7
1
vote
1 answer

pyinstaller generated executable cannot find octave_kernel\\kernel.json

I am trying to re-use some octave code (in 1 .m file) in a short python script using oct2py. The python script runs correctly from the cmd console. I can even package it into an exe using pyinstaller (no Errors, only a few warnings), but when I run…
DNR
  • 31
  • 4
1
vote
0 answers

oct2py not working from script (ubuntu)

I have installled oct2py and I can import octave in shell interactive python3 mode. lukas@lukas-VirtualBox:~$ python3 Python 3.5.2 (default, Sep 14 2017, 22:51:06) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for…
zubro
  • 147
  • 7
1
vote
0 answers

Calling octave .m function from python not executing

I understand this question has been asked multiple times and answered in different forums but it looks like there are variants of the issue and mine is probably, slightly different. Let me explain. I am trying to call a octave function which I had…
sunny
  • 643
  • 2
  • 11
  • 29
1
vote
0 answers

oct2py failes to init with WinError 5 access denied

I have installed miniconda python version 3.6.1. conda,python,oct2py and all dependencies packages are up to date. Both python and octave are installed using 64 bit windows binary installers. In python script I only use from oct2py import octave …
vintox
  • 55
  • 8