필터 지우기
필터 지우기

At what line does my parfor loop error?

조회 수: 8 (최근 30일)
Tom
Tom 2014년 12월 12일
답변: Sean de Wolski 2014년 12월 12일
Hello World,
I am using the parfor command to run a job on multiple processors. I am running the same function on over 100 files and the function works for most files but not all. I am getting an error which indicates at what line the error occurred in my function and sub-functions but does not indicate on what file the error occurred.
Is there a way I can have matlab output the more information about where the error occurred?
Example:
-------------------------
% Run_all_files_script.m
parfor fileNumber = 1:10
main_function(FileName(fileNumber));
end
-------------------------
example of error:
"Error in Run_all_files_script (line ##)
parfor fileNumber = 1:10"
Is there a way I can output what "fileNumber" is equal to at the time of error?
Thanks,
-Tom-

채택된 답변

Sean de Wolski
Sean de Wolski 2014년 12월 12일
parfor ii = 1:100
try
process_file(ii)
catch
error(['Error in File ' num2str(ii)])
end
end
Try/catch is probably the easiest.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by