Python Forum
How to import Octave to Python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to import Octave to Python (/thread-17796.html)



How to import Octave to Python - gurbhej_singh - Apr-24-2019

Greetings for the day,
I am a beginner with Python. I want to import octave in Python.
I want python takes the octave file and show the result in the python window.
Thank You.


RE: How to import Octave to Python - scidam - Apr-24-2019

Are you talking about interpreting and executing Octave code by Python or translate octave code to Python code?

Look at oct2py package.

Having an octave file of intermediate complexity, you probably will need to
rewrite it using specific (external) Python libraries (e.g. Numpy, scipy etc.). In very simple cases
, e.g.x=2; y=3; z = x + y, that code could be executed directly by Python (or easily translated to Python).


RE: How to import Octave to Python - gurbhej_singh - Apr-24-2019

(Apr-24-2019, 10:00 AM)scidam Wrote: Are you talking about interpreting and executing Octave code by Python or translate octave code to Python code?

Look at oct2py package.

Having an octave file of intermediate complexity, you probably will need to
rewrite it using specific (external) Python libraries (e.g. Numpy, scipy etc.). In very simple cases
, e.g.x=2; y=3; z = x + y, that code could be executed directly by Python (or easily translated to Python).

Thank you for your reply.
I want to execute octave code in Python and results were shown in the Python window.
I have gone through the link given by you and download the latest version of oct2py. But I am not able to understand what to do with that file. I am a Windows user.
From where I can get the Python libraries (numpy and scipy)?
Is there any other library needed to import octave to python?


RE: How to import Octave to Python - gurbhej_singh - May-03-2019

Greetings for the day.
I have successfully imported octave in Python and now I am able to execute my Octave program through python.

Following steps are needed to be done:
1) Install Numpy with command 'pip install numpy'
2) Install Scipy with command 'pip install scipy'
3) Install oct2py with command 'pip install oct2py'
4) Set the path of the octave if needed with command setx path "path of octave;

Thank You.