# Efficient Matlab Programming

### From NA-Wiki

Here are some notes on how to write good and efficient Matlab code. It covers:

- Pre-allocation of memory
- Inline and anonymous functions
- Vectorization via element sub-scripting
- Vectorization via logical index masking
- The benefit of JIT
- Direct and "indirect" indexing
- Copy-on-write
- Construction of sparse matrices