During the last year I have written several small Matlab programs which I needed to include in my masters thesis which I am writing in LaTeX. The easiest way to do this is using the LaTeX package called listings.
This package makes it very easy to include and highlight all sorts of programming languages. The list of supported languages is quite long:
ABAP,ACSL,Ada,Algol,Ant,Assembler,Awk,bash,Basic,C,C++, Caml,Clean,Cobol,Comal,csh,Delphi,Eiffel,Elan,erlang, Euphoria,Fortran,GCL,Gnuplot,Haskell,HTML,IDL,inform,Java, JVMIS,ksh,Lisp,Logo,make,Mathematica1,Matlab,Mercury, MetaPost,Miranda,Mizar,ML,Modula2,MuPAD,NASTRAN, Oberon-1,OCL,Octave,Oz,Pascal,Perl,PHP,PL/I,Plasm,POV, Prolog,Promela,Python,R,Reduce,Rexx,RSL,Ruby,S,SAS, Scilab,sh,SHELXL,Simula,SQL,tcl,TeX,VBScript,Verilog,VHDL, VRML,XML,XSLT