The MATLAB Cookbook teaches MATLAB by example. Modifying existing code to is often the fastest way to learn. So start clicking on the recipes below and get started!
If you have suggestions? e-mail contact[AT] or use the comments page.

  1. Concatenating cell arrays
  2. Concatenating cell arrays in bulk
  3. Quickly creating large matrices
  4. Debugging
  5. Finding NaNs
  6. Generating random numbers
  7. Are two matrices identical?
  8. Programatic control of the mouse
  9. Generating random numbers in a repeatable way
  10. Rounding numbers
programming > Writing better code
  1. Why does my code run slowly?
  2. Speeding up code with pre-allocation
  3. Multiplying arrays without using loops
  4. Vectorising for speed
  5. Avoiding nested loops
  6. Loading and saving MAT files is slow
  7. Creating a series of variables with a loop
  8. Repeatedly calling a function
Text Processing
  1. Concatenating strings
  2. Comparing two strings
  3. Concatenating strings and numbers
  4. Overwriting text output at the command line
  5. Regular expressions: complicated string matches
  6. Searching for a string
Plotting > Plot Manipulation
  1. Setting line properties the tidy way
  2. Creating multiple panels in one window
  3. Creating complicated arrangements of sub-plots
  4. What is a "handle"?
  5. Modifying sub-plot panels after they've been created
  6. Altering the order of plot elements
  7. Ensuring underscores don't lead to subscripted characters
  8. Modifying figure background colour
  9. Setting axis background colour in printed graphics
  10. Add axis labels only to peripheral sub-plots
  11. Overlay mean on a histogram
  12. Positioning figures on the screen
Plotting > Distributions
  1. Visualising a distribution
  2. Modifying histogram properties
  3. Overlay a Gaussian distribution onto a histogram
  4. Overlay a smoothed distribution onto a histogram
  5. Improving clarity by "jittering" data points
Plotting > Line and Scatter Plots
  1. How do I make a scatter plot?
  2. How do I plot objects outside of the axes?
  3. How do I plot a circle?
  4. How do I plot a sine wave?
  5. How do I plot a spiral?
Plotting > 2D Data
  1. Artifacts in surface plots exported as EPS
  2. Missing pcolor data
  3. Interpolating a pcolor plot creates odd artefacts
  1. Displaying data in a grid
  2. Calculating the standard deviation
  3. Calculating the standard error of the mean
  4. Performing a t-test
  5. Plotting simple bar charts
  6. Plotting less simple bar charts
  7. Making simple box plots
  8. When to plot a bar chart and when a box plot?
  9. How do I cluster my data?
  10. How do I perform k-Means clustering?
  1. Making a movie from 2-D matrices
  2. Importing a tiff movie
  3. How do I make a compressed .avi in Linux/Mac?
  4. How do I make an animated gif?
Branching Out
  1. What alternatives are there to MATLAB?