Possible erroneous lint message when using SPRINTF
Afficher commentaires plus anciens
Hello all,
I am using SPRINTF to format a string for a plot title, like so:
str = sprintf('The title %s', f)
I get the lint message "The function SPRINTF is apparently called with a cell array (argument 2)".
The variable f is defined as such: If the value of another variable n equals 1 then f is defined as a cell array of strings {'1Hz', '2Hz', '3hz'}. If n equals 0 then f is simply a 1x3 character array ['3Hz'].
When I use SPRINTF in the instance above, the value of n is always 0, so f in this case would never be a cell array. Yet MATLAB seems to assume that, because f is sometimes a cell array then it is a cell array (which in this case it is not).
Basically, is there a way of suppressing this message? I like my lint checker to be green and it's bugging me :-)
Thanks,
Louis Vallance
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur MATLAB Report Generator dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!