How to get access to Gerd's m-files:

Please note: Although much of this information is still relevant, the tar file is old and some of the setup procedures have changed.
Alexandra Seremina was so nice to translate this page to Romanian. Should you be a Romanian speaker please follow the link to her page .
In case you are new to Matlab and start from scratch:
  1. Create a directory matlab in your root directory (e.g.  Heidi should have done  mkdir /home/cullen/matlab).
  2. Go to the new directory.
  3. Use the editor of your choice to create a new file startup.m.
  4. Add the line gerdstartup5 .
    Download the file gerdstartup5.m and put it in your matlab directory. Start matlab and it should work.

    Note: this will work on machines which have the directory /more/matlab from ocp.ldeo.columbia.edu mounted. Your system administrator should be able to help you, in case you can not find the directory. Currently they are available as described above on most linux boxes and all the SUNs of Lamont's computer network.

  5. Then add the line gerdstartup5 .
In case you already have a working startup.m file in your ~/matlab directory:
  1. Add the line described above to your startup.m .

In case you can not mount ocp's directory (that's the case for everybody outside of LDEO) you can now download the whole stuff. Be warned, it's 160MB. Why that much ? It includes the full coastline database used also in GMT ! Where to find it ? Here.

In case you can or do not want to download the big archive, you can now find an html listing and the code for a number of the m-files here.

Various m-files:

Always try the help for any particular function before asking me ! And read it carefully !

Conventions in my help and in my functions (this differs from the standard look and feel of Matlab help because I find it too messed up) :


You can find an html listing and the code for several of the following files here.
Graphics
loammap Draw a nice map of scalars or vectors together with outlines of the continents.
contourpm Draw a contour-plot differing between positive, zero and negative lines (color and b/w).
errorbar2 Draw a line plot with error bars. In difference to standard Matlab this function allows bars in 2 directions.
coledit Interactive tool to create a new color map. (see also the coledit home page )
exportfig Ever wondered how to get a figure on the paper with the same aspectratio as the one you had on the screen ? Try this function. It's supposed to handle that problem. (thanks Bruce!)
colorbar3 Thinner colorbar with label. Draws only used contourlevels when applied to a contourf graph.
stretch Change the distribution of colors within a colormap. E.g. if you want to concentrate the resolution into one end of the color range or if you want to concentrate it around 0.
arrow Draws nice arrows (read the help carefully!).
ceven Center color range around 0
Data manipulation
nans Replaces elements in an array (e.g. replace -999 by NaN).
remseason Remove seasonal cycle from an array or vector.
Simple data analysis functions
nmean / nmin / nmax
nmedian / nstd /ncumsum
nsum
Applies the respective function to arrays despite NaN's.
rms Calculates the root-mean-squared.
binav Calculate bin-averages
lastval Grab the last non-NaN number from an array (dimension can be specified)
Complex data analysis functions
objmap Do an objective analysis of your data.
geteof Calculate EOFs (principal components). 
cancorr Do a canonical correlation analysis.
getmssa Do MSSA
lagcorr Do a (lagged) correlation. 
lagcov Calculate the (lagged) covariance. (also useful for calculating regressions)
veccor Calculate the correlation between two vector series/maps.
corrsig Calculate the significance of a correlation coefficient
File handling
readnc Load variables and attributes from a NetCDF file. Can load only parts of a variable !
ncload2 Like ncload (loads a variable from a NetCDF file), but replaces 'missing_value' by NaN
hdrload Load an ASCII file which has a non numerical header.
textread / dlmread Load mixed character/number ASCII files.
save2cdf Save one variable with several attributes in a NetCDF file.
Geophysical functions
geowind Calculate geostrophic winds from SLP

Tips and Tricks:

Links:

Questions and Answers:

mailing-list:

last modified June 17th, 2004.
send comments and question to  Gerd