Acquire Data in Background Thread

조회 수: 9 (최근 30일)
Randall Reynolds
Randall Reynolds 2020년 6월 4일
댓글: Randall Reynolds 2020년 10월 1일
Hello,
I am trying to create a data acquisition script that streams picoscope data. I do not have a lot of experience with MATLAB UI development, but I have expereince in other such as Python and Java; in these applications, I would offload the background data acquisition to a background/worker/separate thread with callbacks the UI. In my MATLAB application, I need to offload some data processing to a separate thread and the save to a file. It would be fine if the data acquisition happened in the main or worker thread. I have seen some funtions such as batch (Parallel Processing Toolbox), start(Data Acquisition Toolbox) and startBackground(Data Acquisition Toolbox), but I do not have acess to these toolboxes. Does anyone know of a way to accomplish this task? Thank you.
  댓글 수: 8
Walter Roberson
Walter Roberson 2020년 9월 30일
If the needed data was from before the parfor started then parfor would normally copy the data in when it sees reference to it, but you can also be more specific with https://www.mathworks.com/help/parallel-computing/parallel.pool.constant.html which has potential performance improvements.
Data can be sent between client and worker using parallel data queues, in either pollable or nonpollable varieties https://www.mathworks.com/help/parallel-computing/parallel.pool.dataqueue.send.html
If you are using Mac or Linux then sometimes it is worth using the File Exchange contribution to do shared memory. However I suspect that has not been updated to take into account changes to representation of complex values in R2018a (I think it was) -- that changed the header representation so the changes affected even non-complex variables.
Randall Reynolds
Randall Reynolds 2020년 10월 1일
Thanks for all the advice Walter!!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by