Code covered by the BSD License  

3.4

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

MATLAB Functional Programming Style Guidelines

by

 

08 Feb 2011 (Updated )

An annotated presentation for MATLAB programming style guidelines

| Watch this File

File Information
Description

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

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

http://en.wikipedia.org/wiki/Functional_programming

20 Nov 2012 Friedrich

Thank you very much!

07 Sep 2011 Fayssal El Moufatich

Derek,

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

BR,
Fayssal

03 Sep 2011 Derek O'Connor

Fayssal,

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.

02 Sep 2011 Fayssal El Moufatich

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

25 Aug 2011 Daniel Roberts

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

12 Aug 2011 Mo Chen

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 Moufatich

Yes there will be!

17 Apr 2011 Chethan S

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

22 Feb 2011 Fayssal El Moufatich

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

22 Feb 2011 Richard Johnson

The book that grew out of these guidelines was recently reviewed by Loren in her Art of MATLAB blog.
http://blogs.mathworks.com/loren/2011/02/10/book-review-the-elements-of-matlab-style/

15 Feb 2011 Pi Ting

Thanks a lot!

12 Feb 2011 Fayssal El Moufatich

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: http://www.amazon.com/Elements-MATLAB-Style-Richard-Johnson/dp/0521732581/ref=sr_1_2?ie=UTF8&s=books&qid=1297535830&sr=1-2

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

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.

http://www.mathworks.com/matlabcentral/fileexchange/2529-matlab-programming-style-guidelines

11 Feb 2011 Matt McDonnell  
10 Feb 2011 Fayssal El Moufatich

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.

10 Feb 2011 Sean de

I disagree with your conditional preference. Since boolean operators can short circuit, some of the conditional calculations can be avoided.
http://matlab.wikia.com/wiki/FAQ#Do_boolean_operators_short-circuit.3F

09 Feb 2011 Danny Sale

Thank you for uploading this. Great advice!

Updates
01 Sep 2011

Spelling errors corrected.

05 Sep 2011

Addition of a disclaimer

07 Sep 2011

Name correction in the disclaimer

Contact us