I have a python code that works perfectly fine, and I want to use the output of the python's code as an input in the matlab one, How can I do that ?
CodePudding user response:
You can write the code within a function that produces the desired output, call that function, save the result in a variable, and then pass the variable to the matlab function.
CodePudding user response:
Linux shell has pipeline operator |
, that allows to forward output from one command to the input of the second command. Imagine we have 2 python programs, a.py:
print(1)
print(2)
and b.py:
i = int(input())
j = int(input())
print(i j)
So having these two commands, you need to run them like this:
~> python3 a.py | python3 b.py
3
Adapting this to your problem, second command will be matlab program, not python3