divide by zero warning does not appear in version 2012a

1 回表示 (過去 30 日間)
Ed Davis
Ed Davis 2013 年 5 月 29 日
コメント済み: Kayla McCarty 2019 年 2 月 21 日
I am testing some examples in a book and am having the following issue. when dividing by zero, 1/0, the book claims that MATLAB generates a Divide by zero warning message. The book claims to use version R2012b, yet when I test this in version R2012a I do not see any error or warnings on the result is Inf as I would expect. Is there a way to 'turn on' this warning in 2012a or is this a case of a bad example in the book I am using?
I have checked the warning state and have found the following
warning The default warning state is 'on'. Warnings not set to the default are
State Warning Identifier
off MATLAB:Debugger:BreakpointSuppressed
off MATLAB:JavaComponentThreading
off MATLAB:JavaEDTAutoDelegation
off MATLAB:RandStream:ActivatingLegacyGenerators
off MATLAB:RandStream:ReadingInactiveLegacyGeneratorState
off MATLAB:class:DynPropDuplicatesMethod
off MATLAB:class:InvalidDynamicPropertyName
off MATLAB:mir_warning_unrecognized_pragma
off MATLAB:uiflowcontainer:DeprecatedFunction
off MATLAB:uigridcontainer:DeprecatedFunction
off MATLAB:uitab:DeprecatedFunction
off MATLAB:uitabgroup:DeprecatedFunction
off MATLAB:uitable:DeprecatedFunction
off MATLAB:uitree:DeprecatedFunction
off MATLAB:uitreenode:DeprecatedFunction
off spblks:block:FromAudioDevice:fromAudioDeviceDroppedSamples
off spblks:block:ToAudioDevice:toAudioDeviceDroppedSamples
off spblks:system:AudioPlayer:toAudioDeviceDroppedSamples
off spblks:system:AudioRecorder:fromAudioDeviceDroppedSamples

回答 (2 件)

Matt J
Matt J 2013 年 5 月 29 日
I think it's a bad example in the book. I haven't seen the divide by zero warning in any MATLAB version since 2005.

Jan
Jan 2013 年 5 月 30 日
This is triggered by the line
warning off MATLAB:divideByZero
in the function matlabrc.m, which is called automatically at startup. Either change it there, or better in a user-define startup.m file.
  2 件のコメント
Ed Davis
Ed Davis 2013 年 5 月 30 日
If so how do I turn it on.
the line warning on MATLAB:divideByZero runs but does not change the behavior.
Also, the line warning off MATLAB:divideByZero does not appear in the matlabrc.m file. Nor does any other line with the word divide.
Kayla McCarty
Kayla McCarty 2019 年 2 月 21 日
Did you ever figure this out?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by