kj <firstname.lastname@example.org> wrote in message <email@example.com>... > > > One of the most often cited coding "best practices" is to avoid > structuring the code as one "large" function (or a few large > functions), and instead to break it up into many tiny functions. > One rationale for this strategy is that tiny functions are much > easier to test and debug.
I would be careful when applying blindly this "best practice". MATLAB have huge running performance penalty due to function overhead (as opposed to other programming language as C, fortran, ...)
You will slow down the code by putting simple (scalar) arithmetic expressions in function. If the expression is vectorized and supposes to operate on big array, then it's OK to put it in the functions.