If I suppress an error, will the error still be suppress if I open the file on another computer?

1 vue (au cours des 30 derniers jours)
If I suppress an error, will the error still be suppress if I open the file on another computer?
  3 commentaires
Nam Vinh Nguyen
Nam Vinh Nguyen le 30 Août 2021
No, like I right click on it and there is an option to suppress it so I click on it. It happens when I try to use str2num

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 30 Août 2021
If you ask to surpress for that one line, then a comment is added to the line with a %#ok pragma. That comment will stay attached to the line as it is part of the source code.
If you ask to surpress for that all lines in the file, then a comment is added to the line with a %#ok pragma, very similar to the previous case. That comment will stay attached to the line as it is part of the source code.
If you ask to surpress for all files, then your MATLAB preferences are modified, same as if you had set your Code Analyzer preferences. This change will be stored in the preferences information for that one version of MATLAB for that one user on that one system. If the user upgrades to one of the next two releases, then the upgrade procedure will copy that preference information for use with the new version, but it will not copy preferences for more than 2 years: the logic for that is that old preferences might not be compatible with the newer release. This kind of preference change is not copied with the file, and will not be copied to a different computer.

Plus de réponses (1)

the cyclist
the cyclist le 30 Août 2021
Errors cannot be suppressed. If you mean supressing a warning, then I would expect that the best way to ensure the warning is suppressed on another computer is to put
warning('off',id) % Use the specific id of the warning you wish to suppress
in the code. See this documentation and related pages for details.
  2 commentaires
Nam Vinh Nguyen
Nam Vinh Nguyen le 30 Août 2021
Do you happen to know the warning ID for when you try to use str2num but MATLAB tells you that str2double is better?
Walter Roberson
Walter Roberson le 30 Août 2021
That message is from the code analyzer, not from MATLAB itself

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by