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
oct2py
subprocess
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).
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);'])?
subprocess.run(['octave-cli.exe','[v,f]=fft_of_signal(value,T);'])
Thanks in advance!
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
scipy.io.loadmat
1.4m articles
1.4m replys
5 comments
57.0k users