Error thrown in a parlor loop
5 次查看(过去 30 天)
显示 更早的评论
I am trying to speed up some computations using the parallel toolbox - particularly replacing a far loop with a parfor loop. I have made each iteration of the loop independent and debugged it using a normal for instead of parlor. There are 8 captured signal buffers. I want to find the time of arrival of a given signal in each buffer. The loop is 8 long - one for each buffer.
I first using a correlation procedure find the coarse TOA in a buffer and then using a different algorithm find the fine TOA and fill in the fields of a structure with the data. The results is an 8 dimensional structure array (already memory allocated). I have verbose debugging print out in the loop. When I run it with for - is is fine. When I run it with parfor it will do 3 and blow up one time and 6 and blow up the next time. The error is thrown during parfor gives me no clue to where the true error was. I put a try/catch around the contents of the loop but that did work either.
The specific error is "Subscripted assignment between dissimilar structures.
"Error in calc_SRS_pseudo_ranges_Ver_P (line 96) parfor n=1:num_int;"
Line 96 is the start of the parfor statement so this tells me nothing. Two questions - why will it work for some number properly and they blow up and any idea on how I better hone in on the actual line of code that is causing this?
Any help or suggestions will be appreciated.
Thank You Truman Prevatt
0 个评论
采纳的回答
Edric Ellis
2014-7-10
Have you tried debugging the loop when running it as a PARFOR? You can force the PARFOR to run locally in your desktop MATLAB instance by changing
parfor idx = 1:N
to
parfor (idx = 1:N, 0)
I suspect that the problem is that some structure that you're building inside the loop changes form somehow as the loop progresses.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!