MATLAB Programming Style Guidelines
Advice on writing MATLAB code usually addresses
efficiency concerns, with
recommendations such as "Don't use loops." This document is different.
Its concerns are correctness and clarity. The goal of these guidelines
is to
help produce code that is more likely to be correct, understandable,
sharable
and maintainable.
Key Elements
- Naming conventions
- Language usage
- Layout and comments
Download MATLAB Style Guidelines
(Revised V1.5), (93 KB PDF file)
Look
for a revised and expanded version in 2010.
Feedback on the guidelines:
I thought this document
encapsulated a boat load of good advice
relevant for many programming languages, and included some nice MATLAB
specific hints.
_
Penny Anderson
Really helpful. everybody
should read something
like this before starting any coding ! (Now, it's my turn to
review everything that I did)
_
Frederic Bosche
After I read this article,
I'm impressed some good stuff that I used
to ignore or misuderstand. This pdf file is easy understood and it's
especially useful
for MATLAB experienced programmers. The guidelines helped me to
construct a more
standardized, easy-maintained programs. No matter what kind of
language you are
using, there will be some concepts you can refer to.
_
Fu-Sung Wang
Clear, concise and
reasonable. Should be alot of help to
me (and others). Thanks.
_
Richard Kirkeeide
Concise and thorough
_
William Zimmerman
Useful, short document that
reminds one of all the
things they should already do, but probably don't.
_
Mark Newton
An excellent collection,
great for beginning or intermediate Matlab coders.
_
Michael Villalba
Great & Appreciated
Guidelines! I hope I can follow all of them!
_
Fahad Al Mahmood
Concise, good examples
_
James Cline
Very helpful. I typically
write in MATLAB, and I haven't
read about style guidelines before. This will help me write more
readable
and more maintainable MATLAB code.
_
B G
Great work. The document is
well-written and spot-on.
A much-needed addition to the MATLAB community.
_ Matthew Simoneau
MATLAB and TDD
MATLAB code is often written without the benefit of a software
development methodology. Agile Programming is a lightweight
methodology that is well suited to MATLAB development. Test-Driven
Development is a core agile practice that can help produce better code.
Key Steps
- Write a test based on a user story.
- Write just enough code to pass the test.
- Refactor for a better design.
- Repeat.
Download MATLAB and TDD,
(118 KB PDF file)
MATLAB Data Containers
MATLAB has four array types plus objects. All of these have a role to
play in working with data. The choice of the type of data container to
use can have a big impact on your code. This paper discusses the
options
and provides examples of their use. It is mostly at an introductory to
intermediate level with some tips for more advanced use.
Key Elements
- Use numeric arrays whenever they are good
enough.
- Use cell arrays primarily for character strings.
- Use structures to bundle multiple data types or
multiple arrays into a single variable.
- Use objects to limit access to and manipulation
of data.
Download
MATLAB Data Containers,
(105 KB PDF file)
Data Visualization Toolbox for MATLAB
MATLAB software implementing
and extending the analytical and graphical methods for data analysis
and
visualization described in William S. Cleveland's Visualizing Data.
Key Benefits
- Analysis using robust statistical methods.
- Graphical methods for data exploration.
- Diagnostics for fit and model evaluation.
This software is included in the training classes.
Feedback on the toolbox:
Its great software thank
you.
_James
McEwan, University of Waikato
Great job.
_Lennard
van der Hulst, Ingenieursbureau S.D. Kamminga BV
Very good work!
Congratulations.
_Tom
Bryan, The MathWorks, Inc.
Cool M-files
_Steve
Lord, The MathWorks, Inc.
Magnificent job.
_Diego
Holmgren, San Francisco State University
|