How do I code for using multithreaded parallelism?

1 次查看(过去 30 天)
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 中查找有关 Get Started with MATLAB 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by