Running 2 processes concurrently in real time
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
José-Luis
2016-7-5
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).
回答(1 个)
Walter Roberson
2016-7-5
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"
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multicore Processor Targets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!