File Exchange Pick of the Week

Our best user submissions

Avoiding Coding Pitfalls


The file submission referenced in this post is no longer available on File Exchange.

Whenever Loren Shure posts a new discussion about writing MATLAB code, anyone who wants to improve his or her technique should take notice. Loren may be the most MATLAB-savvy person I know, and is certainly my go-to person when I'm having difficulty understanding some MATLAB concept or implementation. This week, I would like to call attention to a new submission on the File Exchange to make sure that everyone knows it's there. Although the file was submitted by fellow MathWorker Linda Webb, it is actually a reprint of a News & Notes article that Loren wrote in 2008.   With concise examples, the article points out common pitfalls in MATLAB concerning: matrix and element-wise multiplication, transpose and conjugate transpose, using i or j as variables, command/function duality, and floating-point comparisons. Loren also provides some great tips on writing robust programs, with brief discussions of function handles, the use of "eval." I encourage anyone who wants to learn from the master to download and read Loren's article. And make sure to subscribe to your favorite MathWorks newsletter, while you're at it. They're packed with pearls of wisdom!

Published with MATLAB® 7.7



To leave a comment, please click here to sign in to your MathWorks Account or create a new one.