Running 2 processes concurrently in real time

6 visualizaciones (últimos 30 días)
Rafi Zack
Rafi Zack el 5 de Jul. de 2016
Respondida: Walter Roberson el 5 de Jul. de 2016
Hello,
We are running 2 processes in real time concurrently (in a loop): 1) 1st process: recording a real time signal 2) 2nd process: analyzing the previous signal (received from the 1st process) while the current signal (received from the 1st process) is being recorded. The 2 processes need to communicate with each other.
Currently, the only way that this works is by running 2 Matlab instances concurrently. And the communication is done by saving data files, and reading and writing to these files from the 2 processes.
Is there a solution to run these 2 processes in the same time from one Matlab instance? We wish to be able to execute these 2 processes without the need to save any data files.
We tried the "batch" function solution, however it does not work because it takes it approx 2 secs just to load the 2nd process, while the processing itself takes only 1 sec, and each time the process finishes (the 2 processes run in a loop), it takes another 2secs to load the next process and so on....Also- is there a way to load a process only once and then leave it in the background also when it is not in use, in order to avoid to the delay related to having to load it each time we call this process....
So, our question is- how do we run 2 concurrent processes in real time from one Matlab instance without getting any delays? time is crucial in our app.
thanks!!
  1 comentario
José-Luis
José-Luis el 5 de Jul. de 2016
It sounds that you need something lighter than what Matlab provides.
I haven't really seen great tools for inter-process communication for Matlab (I might be wrong with that) but there are very many of them for C++ (e.g. boost interprocess is great).
Matlab however, provides a C++ api that you could then use and have your processes talk from there.

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 5 de Jul. de 2016
You can use MATLAB's spmd and you can use labSend() and labReceive() to have the two communicate.
Is there a reason you do not put each of the two in a loop so that they repeat the same function over and over without needing to constantly create new processes?
By the way you might want to look at the File Exchange Contribution "sharedmatrix"

Categorías

Más información sobre Multicore Processor Targets en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by