필터 지우기
필터 지우기

Suppress error warnings in matlab (when using parfor loop)

조회 수: 3 (최근 30일)
Anthony Barone
Anthony Barone 2015년 3월 13일
편집: Anthony Barone 2015년 3월 19일
I am trying to supress a specific error message in one on my codes (specifically a "no start point" warning in a curve fitting function). I have found the warning using:
w = warning('query','last')
and then disabled/enabled that specific warning at the top/bottom of my script, such that:
warning('off','curvefit:fit:noStartPoint')
*body of script here*
warning('on','curvefit:fit:noStartPoint')
However the warning is not being suppressed. Am I doing something wrong?
Thanks in advance.

채택된 답변

Edric Ellis
Edric Ellis 2015년 3월 16일
If the warning is being generated on the workers, you need to apply the warning suppression there too. You could do it like so:
spmd
warning('off','curvefit:fit:noStartPoint')
end
  댓글 수: 1
Anthony Barone
Anthony Barone 2015년 3월 19일
편집: Anthony Barone 2015년 3월 19일
The issue was that I needed to apply the warning for the workers. Your method worked, as did applying the warning suppression inside the parfor loop where the curve fitting was occurring. Thank you for the help in figuring this out!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Dima Lisin
Dima Lisin 2015년 3월 13일
Hi Anthony,
Your script may be generating some other warning. Try checking the last warning again.
  댓글 수: 2
Anthony Barone
Anthony Barone 2015년 3월 13일
It seems to only be generating that singular warning.
I have also tried suppressing ALL warnings using:
warning('off','all')
*body of script here*
warning('on','all')
and the warning message still appeared, making my think I am fundamentally going about it the wrong way. Is there any other way to go about doing this?
Anthony Barone
Anthony Barone 2015년 3월 13일
I have figured out why it is doing this: It is because this script contains a parfor loop, and for some reason the parellization of the code makes the warning appear even when being suppressed. Changing it to a regular for loop suppresses the warning correctly.
Any ideas why this would happen, and/or how to suppress warning when the code contains a parfor loop?

댓글을 달려면 로그인하십시오.

카테고리

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