How do I code for using multithreaded parallelism?

조회 수: 1 (최근 30일)
Daniel Lanza
Daniel Lanza 2019년 5월 2일
답변: Sreelakshmi S.B 2019년 5월 7일
Hello, I'm new to MATLAB, and I've been learning how to operate it over the last couple of months. There is a code I'm working on for data collecting and data analysis, and one of the things I'm trying to have it do is to initialize a data stream for data collection in the background, while the user can still perform data analysis or any other operation. I want to accomplish this task by using parallel computing; to be more specific, I want to use multithreaded parallelism. However, I'm not familiar with this style of coding, as I heard of it very recently.
As such, I wanted to ask: can anyone show me how to code in parallel computing to accomplish this sort of task? Or at the very least, can anyone show me an example of how to use multithreaded parallelism in MATLAB for running a function in the background? I'm sorry for not being able to provide any scripts to show, since I dont have any clear idea of how to use parallel programing.

답변 (1개)

Sreelakshmi S.B
Sreelakshmi S.B 2019년 5월 7일
You can use 'parfor' to execute for loops in parallel.
Go through https://in.mathworks.com/help/parallel-computing/parfor.html for more information on parfor
To evaluate a function in the background, you can use 'parfeval'.Refer the link below for more details on how to use parfeval:

카테고리

Help CenterFile Exchange에서 Parallel Computing에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by