Info

This question is closed. Reopen it to edit or answer.

a problem in parallel computing

1 view (last 30 days)
haniyeh
haniyeh on 20 Nov 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
Dear all, I need help to do a parallel process for my optimization code. Could you please help me? When I use "parfor", I see this error:
Error using MyCost (line 24) In an assignment A(I) = B, the number of elements in B and I must be the same. Error in @(p)MyCost(p,x0)
Error in Test_ga_Parallel (line 210) parfor i = 1:length(pop)
.... Thanks in advance.
  2 Comments
Edric Ellis
Edric Ellis on 21 Nov 2014
This looks like an error in your MyCost function. Without further details, it's impossible to tell why this error is occurring.
Adam
Adam on 21 Nov 2014
Edited: Adam on 21 Nov 2014
Replace the parfor with a for and make sure it is at least syntactically correct for a basic for loop first.
A syntactically correct for loop doesn't automatically mean a syntactically correct parfor, but a syntactically incorrect for loop does always mean a syntactically incorrect parfor!

Answers (0)

Community Treasure Hunt

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

Start Hunting!