How to pass data between parallel tasks that don't terminate?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a data logging & monitoring tool that I've written using the App Designer. It creates a timer object in the background to retrieve data, saves it to a file, and updates the display. Since it's a single-threaded application, I can't save data any faster than I can update the display (which is rather slow). Because of this, my timer can't run faster than about 1x per second. Ideally, I'd like to save data to the file at 10-100x per second, even if the display updates more slowly.
I have the parallel computing toolbox, so I've been looking at running the data collection and plotting as parallel tasks. The app display would refresh using a timer as it does today, but the data collection would run as a background parallel task continuously sampling data (while(1)) as fast as possible.
It appears that the branch and parpool functions both require you to wait until a task is complete before accessing its data. Since the data collection task never ends, I'm not sure what to do.
In summary, here's what I'm looking for:
- Data collection task - Runs continuously, appends readings to DATA matrix, writes to output file
- Screen update task - Runs 1/sec, only displays the latest value from DATA matrix
0 Commenti
Risposte (1)
Sid Jhaveri
il 6 Dic 2016
If waiting till task is completed is the only issue while using Parallel Computing Toolbox, then you can try using " parfeval " or " parfevalOnAll " functions of Parallel Computing Toolbox.
To learn more about asynchronous parallel programming in MATLAB, refer to the link given below: https://www.mathworks.com/help/distcomp/asynchronous-parallel-programming.html
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!