3

I would like to make a python variable available in real time in MATLAB. For example:

Python code:

import numpy as np
x = []
for while 1:
    x.append(np.random.rand(1))
    # send x to matlab

after each/several python iterations .... MATLAB code:

% receive x
py.len(x)
% do some other matlab stuff

In reality, it would take me a long time to recode the Python functions in MATLAB language. Is there a way to do this? Is this a job for the matlab-engine? given that I would be streaming real-time data, I would like to send data from python to MATLAB relatively fast, within reason. I would also like to run the Python portion in the background, using parfeval and some sort of "send" function to send x through a queue back to the matlab client.

PS: this question is similar to the one asked here. However, the answer was not too explicit and might be dated (7 years ago)

Real-time data transfer from Python to MATLAB

dleal
  • 2,244
  • 6
  • 27
  • 49

0 Answers0