MATLAB Compiler    

Nonscalar Arrays

(fold_non_scalar_mxarrays) This optimization is very similar to fold_scalar_mxarrays. It folds nonscalar mxArray values into compile-time arrays that are initialized at program start-up. This can have a large performance impact if you are constructing arrays that use [] or {} within a loop. This optimization makes the code less readable. For example:

If you compile this with the -O none option, you get

Compiling with -O none -O fold_non_scalar_mxarrays:on gives


  Optimizing Arrays Scalars