Search This Blog

Download : The Elements of MATLAB Style

Written By share_e on Tuesday, March 13, 2012 | Tuesday, March 13, 2012


Buy This Book
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. This is a very clearly organized and written book. Serious Matlab users will have already formed opinions and developed 'styles' on many of the topics covered, but the author's suggestions and the underlying reasoning are worth considering nevertheless. I found myself agreeing with about 80% of his material and at least half of the remainder was at least worth considering.

An example: the author recommends arranging code flow (including 'continues', 'breaks', and 'returns' in functions so that there is only a single exit point for the entire function. While I partially disagree (if the input is bad, I see no reason not to incorporate an immediate 'return'; the alternative is bound to involve setting and checking an otherwise unneeded flag), at least considering this principle has made for - I think - better flow in the functions I've written subsequently. And the discussion of Matlab's 'publish' feature, and coding for it, has opened my eyes and those of a co-worker to a whole new way of producing report-quality output automatically. As I write this, I actually make my living writing Matlab code, but I think even for beginners in the language the sample code snippets will make worthwhile parsing.