Clear Filters
Clear Filters

How to convert this for loop to parfor loop?

1 view (last 30 days)
Ahmad Gad
Ahmad Gad on 8 Nov 2017
Edited: Ahmad Gad on 8 Nov 2017
Hello All, I am very new to parallel computing, and I am having hard time converting all my for loops to parfor loops. However, If I understood how to convert this part, I think I will be able to convert many parts of my code. Any help will be appreciated.
I = size(A,1);
J = size(B,2);
parfor i = 1:I
for j = 1:J
C(i,6*j - 5) = U(6*B(i,j) - 5,1);
C(i,6*j - 4) = U(6*B(i,j) - 4,1);
C(i,6*j - 3) = U(6*B(i,j) - 3,1);
C(i,6*j - 2) = U(6*B(i,j) - 2,1);
C(i,6*j - 1) = U(6*B(i,j) - 1,1);
C(i,6*j - 0) = U(6*B(i,j) - 0,1);
end
end

Answers (0)

Categories

Find more on Parallel for-Loops (parfor) in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!