How can I make use of Parallel Computing Toolbox to speed up my nested for loop?

Hi, Any advice on speeding up my nested for loop with Parallel Computing Toolbox or Distributed Computing Server? An extract of my code in the following: the calculatearea function call is called 5000*1500 times. Thanks!
i.e.
area = zeros(5000,1500);
for i = 1:5000
for j = 1:1500
area(i,j) = calculatearea(i,j,power,lat,long);
end
end

Answers (1)

The best way would probably be to vectorize your calculatearea routine.

1 Comment

I agree. With parallel computing you have to start 1500 or 5000 or 7500000 jobs. It is worth to try to avoid the overhead required for this.

This question is closed.

Asked:

on 13 Jan 2012

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!