mtexWarning edit page

print a warning without a backtrace, wrapped to the command window

Description

The command window paints everything written to the error stream - which is what fprintf(2,...) does - in the colour set under Preferences -> Colors as "Error text", red by default. A note about an assumption MTEX made then looks exactly like a failed import, and users reasonably read it as one. Only text the warning function emits gets the "Warning text" colour, orange by default, so anything meant to be read as a warning has to go through warning.

Two things about warning are in the way and are dealt with here: it appends the call stack, which for a note like this only names MTEX internals, and it does not wrap, so a paragraph runs off the window or breaks mid-word. The text is wrapped to leave room for the "Warning: " prefix, and hyperlinks survive it.

Passing an identifier lets a user switch a recurring note off with warning('off',id).

Syntax

mtexWarning(format,...)
mtexWarning(id,format,...)

Input

id warning identifier, e.g. 'MTEX:eulerCorrectionAssumed'
format format string as accepted by sprintf

See also

mtexError

Citing this page. This page is part of the documentation of MTEX, a free and open source MATLAB toolbox for analyzing and modeling crystallographic textures. It was written by The MTEX Developers and is published at https://mtex-toolbox.github.io/mtexWarning.html. If you use MTEX, or reuse text or figures from this page, in your research, please cite

F. Bachmann, R. Hielscher, H. Schaeben: Texture Analysis with MTEX - Free and Open Source Software Toolbox, Solid State Phenomena 160 (2010), 63-68. 10.4028/www.scientific.net/SSP.160.63

BibTeX
@article{bachmann2010mtex,
  author  = {F. Bachmann and R. Hielscher and H. Schaeben},
  title   = {Texture Analysis with MTEX - Free and Open Source Software Toolbox},
  journal = {Solid State Phenomena},
  volume  = {160},
  pages   = {63-68},
  year    = {2010},
  doi     = {10.4028/www.scientific.net/SSP.160.63},
  url     = {https://doi.org/10.4028/www.scientific.net/SSP.160.63}
}

Other papers describing specific MTEX methods are listed under Publications — please cite the one that best fits your application. The MTEX source code is licensed under the GNU General Public License v2.0; the text and figures of this documentation are licensed under CC BY 4.0, which permits reuse — including by automated systems — provided The MTEX Developers and this page are credited.