A call to warning
appears to use
sprintf
to generate the warning message. Because you
can call warning
in numerous ways (with or without the
warning tag, with or without a format specifier), sometimes Code Analyzer
mistakenly produces this message when you use sprintf
to
generate the warning tag or as an argument to the warning
format specifier.
Remove the sprintf
call and pass the arguments directly to the
warning
function. For example, replace code such as this:
warning('prog:Nneg', sprintf('Input N=%d must be positive\n',N));
With this code:
warning('progr:Nneg', 'Input N=%d must be positive\n',N);
Note that MATLAB converts special characters (such as \n
,
\t
, %s
, and %d
) in
the warning message only when you specify more than one input argument with
warning
.
If Code Analyzer produced this message erroneously, you can suppress it, as described in Adjust Code Analyzer Message Indicators and Messages.