What are other types of messages than warnings and errors?
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
So far I have been using just two methods for messaging to inform the user during the run of a script: The warning() function:
and the error() function:
They both give simple yet noticeable coloured messages. But at the same time they also contain prefixes Warning and Error using ... (line ...).
I was therefore wondering if there are other methods/functions for messaging that can be quickly sent to the screen during a script? Maybe a neutral message in, say, blue colour that is neither a warning nor an error but simply a note() or message() or FYI() or similar?
Alternatively, are the warning() and error() messages generally editable so I can remove/alter the prefixes?
0 comentarios
Respuestas (1)
Stephen23
el 9 de Feb. de 2018
Editada: Stephen23
el 9 de Feb. de 2018
There is no documented way to get arbitrarily colored text in the command window. The only documented features with colored text are error (red), warning (orange), and by adding a hyperlink (blue):
Actually hyperlinks are more versatile than most users realize, and are sadly underutilized:
To get text in any arbitrary color you could download and use Yair Altman's excellent FEX submission cprintf, which relies on some undocumented functionality and features of MATLAB:
Thus you can simply create your own message using whatever color you want, and even define it in a function called note, message, or whatever. Note that cprintf is not supported by the MATLAB documentation and could break, so use it at your own risk.
Yair Altman's blog explaining the development of cprintf is definitely worth reading:
0 comentarios
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!