View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

3.4 | 10 ratings Rate this file 4 Downloads (last 30 days) File Size: 237 KB File ID: #30334 Version: 1.3

MATLAB Functional Programming Style Guidelines



08 Feb 2011 (Updated )

An annotated presentation for MATLAB programming style guidelines

| Watch this File

File Information

A presentation based on a similar document that was provided by Richard Johnson some years ago. It provides an annotated summary of the main best practice guidelines for writing MATLAB programs.

MATLAB release MATLAB 7.11 (R2010b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (19)
21 Jul 2014 Alexander Kosenkov

That's a questionable naming style guide. It has nothing to do with functional programming

16 Dec 2012 Alex

Alex (view profile)

Please look up the definition of Functional Programming. This has nothing to do with functional programming.

20 Nov 2012 Friedrich

Thank you very much!

07 Sep 2011 Fayssal El Mofatiche


Thanks for the hint! I have inserted a disclaimer accordingly.


Comment only
03 Sep 2011 Derek O'Connor


You should put on the first slide:

This is a re-formatted version of
Richard Johnson's "MATLAB Programming Style Guidelines"

Acknowledging Johnson in the description above is not good enough because the description is not part of the document.

Comment only
02 Sep 2011 Fayssal El Mofatiche

Thanks Daniel for the hint! It should be rectified now.

Comment only
25 Aug 2011 Daniel Roberts

FYI, there's a typo on page 11, 'recommanded' instead of 'recommended'.

Comment only
12 Aug 2011 Mo Chen

Mo Chen (view profile)

The title is very misleading. "Functional style" actually means something like lisp, haskell and OCaml, not how to define your functions.

18 Apr 2011 Fayssal El Mofatiche

Yes there will be!

Comment only
17 Apr 2011 Chethan S

The file name indicates 'part1'. So will there be a part2 for this submission?

22 Feb 2011 Fayssal El Mofatiche

I have already read the article from Loren. Congratulations for putting this book together!

Comment only
22 Feb 2011 Richard Johnson

Richard Johnson (view profile)

The book that grew out of these guidelines was recently reviewed by Loren in her Art of MATLAB blog.

Comment only
15 Feb 2011 Pi Ting

Thanks a lot!

12 Feb 2011 Fayssal El Mofatiche

It's true! And this is stated in the description of the submission. A link to the original document is also included in the references list of the presentation. I submitted this presentation because it is more visually appealing, and it is much lighter to digest than the original document. Does it matter at all? The goal here is that people find these guidelines and adapt them to their programming practices. I also don't see the legend you are talking about, since these are commonly used guidelines in other languages like Java and C++. However, Richard Johnson did a very good job in putting these guidelines together for MATLAB. If you are interested, he even has now published a book on the subject:

By the way, this presentation is not PowerPoint. It is a Lyx beamer-based presentation.

Comment only
11 Feb 2011 Michelle Hirsch

This appears to be a nearly direct copy of Richard Johnson's legendary MATLAB Programming Style Guidelines, just put into PowerPoint format.

11 Feb 2011 Matt McDonnell

10 Feb 2011 Fayssal El Mofatiche

Do you mean regarding introducing logical variables for complex expressions? Of course, short circuiting can save carrying on extra tests. I did not mean to avoid the use of short circuiting completely. It is about breaking complex conditionals into smaller more readable variables that also explain the purpose of the conditionals. So, the goal is to reduce complexity and increase readability. Of course, it could be the case this will incurr extra tests that could be avoided due to short circuiting since we are evaluating all logical variables ahead of the test. In this case, one has to outweigh the gain in performance of using short circuiting vs. the gain in breaking the complexity of conditionals and improving readability.

Comment only
10 Feb 2011 Sean de

Sean de (view profile)

I disagree with your conditional preference. Since boolean operators can short circuit, some of the conditional calculations can be avoided.

09 Feb 2011 Danny Sale

Thank you for uploading this. Great advice!

01 Sep 2011 1.1

Spelling errors corrected.

05 Sep 2011 1.2

Addition of a disclaimer

07 Sep 2011 1.3

Name correction in the disclaimer

Contact us