In 2002, I wrote a brief set of observations and thoughts
on MATLAB style for my coworkers. Other programmers
found it useful, so I posted the “MATLAB Programming
Style Guidelines” document on my website datatool.com. It
has since been downloaded more than 40,000 times.
This book responds to that encouraging interest and incorporates
what I have learned in the meantime. It joins a wellreceived
series of style books on other languages, including
The Elements of Java Style, The Elements of C++ Style, and
The Elements of C# Style.
Much of the advice in this book may be familiar. This is deliberate
because many of the programming principles described
are valid across programming languages. However, the content
has been extensively reworked and expanded here to
address the unique characteristics of the MATLAB language
and development environment environment, as well as the
priorities and practices of MATLAB programmers.
The Elements of MATLAB Style is a guide for both new and experienced MATLAB programmers. It provides a comprehensive collection of standards and guidelines for creating solid MATLAB code that will be easy to understand, enhance, and maintain. It is written for both individuals and those working in teams in which consistency is critical. This is the only book devoted to MATLAB style and best programming practices, focusing on how MATLAB code can be written in order to maximize its effectiveness. Just as Strunk and White's The Elements of Style provides rules for writing in the English language, this book provides conventions for formatting, naming, documentation, programming and testing. It includes many concise examples of correct and incorrect usage, as well as coverage of the latest language features. The author also provides recommendations on use of the integrated development environment features that help produce better, more consistent software.