Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Subscription assignment dimension mismatch when simulations > a certain number of times in parallel computing

1 回表示 (過去 30 日間)
jj
jj 2013 年 4 月 30 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi everyone,
I've another question. I'm new to parallel computing. In fact, I've only started trying to use it today. I've the following in a parallel computing environment:
parfor z=1:16;
g=[1 2 3 4 no. of simulations];
[x(:,:,z),y(:,:,z),a(:,:,z),b(:,:,z)]=function(w,g,z);
end
When no. of simulations is set to 10, the parallel computing works perfectly. But, ideally, I want to run 1000 simulations in this parfor loop. However, when I tried anything above 10 loops, it stops halfway, and gives me an error of "Subscripted assignment dimension mismatch". The z number of cases are independent of each other.
Would anyone be able to point out what is possibly wrong with my code?
Would appreciate any help. Thanks :)

回答 (1 件)

Matt J
Matt J 2013 年 4 月 30 日
Does it happen in a regular for-loop (not parfor)? If so, it should be pretty easy to trap with DBSTOP.
  2 件のコメント
Matt J
Matt J 2013 年 4 月 30 日
In any case, the reason for the error is clear. At some point function(w,g,z) is returning something non-scalar. Why this happens for g>10 is buried inside the definition of the function.
jj
jj 2013 年 5 月 1 日
You are right. It does not work even with a normal for loop beyond g>10. I've tried dbstop if error. It doesn't seem to tell me the line the error has occurred, which is strange.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by