Loren on the Art of MATLAB

Turn ideas into MATLAB

Coding Best Practices – A Good Read 7

Posted by Loren Shure,

Coding Best Practices - A Good Read

I have written blogs before on coding best practices in MATLAB and they have always generated a lot of great feedback. I recently came across a language-neutral list of best practices for scientific computing, written by Greg Wilson of Software Carpentry.

If you don't want to start by reading the whole article, I strongly encourage you to read Greg's summary. He breaks the practices into eight categories. I have to say, I think they are very well stated, starting with "Write programs for people, not computers.".

I have to say, I think Greg hit the nail on the head.

Do You Violate these Best Practices?

The most frequent violations I see include not using a debugger and, a lot of code is trying to optimize it before being sure it is truly correct. Which practice is your Achilles' heel? Let me know here.

Get the MATLAB code

Published with MATLAB® R2013b


Comments are closed.

7 CommentsOldest to Newest

Adrian replied on : 4 of 7

I use and recommend Mercurial for MATLAB development. The MATLAB IDE doesn’t recognise it because it’s not “Microsoft Common Source Standard” but it works perfectly well with m-files, mat files and simulink files etc.

Heady replied on : 5 of 7

I have posted a number of messy TABLE class idioms. I would like MATLAB to be able to compete with Python Pandas or even R, but the TABLE class is awkward.

It would be great if you could have a thread, or even a separate blog (!) to address the elegant use of TABLE.

Heady replied on : 7 of 7

I did see that and it is well done, but I was hoping for some more advanced instruction. Many of my peers use Pandas and I need to be able to perform on that level.