Reputation: 650
I am willing to call Octave from my python script without using the python package oct2py
(I'm having troubles importing it). I am aware of the use of the subprocess
package, but how can I extract the output of an Octave function from this command. I rephrase: say I have a function that computes the fft defined as follows:
function [A,f]=fft_of_signal(Value,T)%coumputes A and f end
Calling this from Octave goes as follows:
octave:1> [v,f]=fft_of_signal(value,T)
.
How can I use subprocess
to ask for the computed values of v and f?
subprocess.run(['octave-cli.exe','[v,f]=fft_of_signal(value,T);'])
?
Thanks in advance!
Upvotes: 0
Views: 228
Reputation: 22245
Dont.
Instead, create an octave script which saves any desired outputs in a .mat file and then exits.
Then, open the .mat file from python using scipy.io.loadmat
Upvotes: 1