How do I code for using multithreaded parallelism?

1 view (last 30 days)
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.

Answers (1)

Sreelakshmi S.B
Sreelakshmi S.B on 7 May 2019
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:

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!