How to run multiple nest-loop with different indexes simultaneously?

1 view (last 30 days)
Hi everyone,
I'm working on a orbital mechanics project: I need to make a pork-chop to find the best moment to launch my spacecraft. Other than use ga, I'm trying to use simple nest-loop cycles to perform the computations.
Due to the high number of point needed to be precise I thought to use parallel computation to reduce time. I can't use parfor because of dependencies inside of loops, I try spmd using a code like the one down here to divide the work between each worker. The code is the same for each worker but with different data input in the fisrt loop cycle of the nest.
I get this error "Error detected on worker 3.
Caused by:
Error using try_parallel_comp (line 72)
Index exceeds the number of array elements (10)."
I think it's due to the fact that the inner loop cycles have bigger indexes than the first one.
Somebody could help me through this please?
spmd (1,4)
if labindex==1
% Code for worker 1
elseif labindex==2
% Code for worker 2
% etc

Answers (0)

Community Treasure Hunt

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

Start Hunting!