Warning does not display message after message identifier

2 visualizzazioni (ultimi 30 giorni)
Why does "warning" not print out the message after a message identifier?
Compare the following:
>> warning('A:B:div0','0/0 operation encountered, converted to nan.') Warning: 0/0 operation encountered, converted to nan.
>> warning('A:B:0div0','0/0 operation encountered, converted to nan.') Warning: A:B:0div0

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 3 Mar 2021
Modificato: MathWorks Support Team il 3 Mar 2021
Each field of the message identifier must start with a letter. In the example above, the last field of the identifier starts with a number, so MATLAB does not recognize it as a valid identifier and instead treats it as a message. The function is then called with the syntax,
>> warning(msg,A1,...,An)
where "msg" is treated as a formatted string. However, the message does not contain any formatting conversion characters (%s, %d, etc.) so the remaining argument is not displayed.
Please refer to the link below for details about the message identifier syntax:

Più risposte (0)

Categorie

Scopri di più su Argument Definitions in Help Center e File Exchange

Tag

Non è stata ancora inserito alcun tag.

Prodotti


Release

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by