Matlab
Here are some matlab scripts that I find useful. They are all
released to you under the GPL, go hog wild with
them. I also make no claims as to the correctness or whatnot of said
scripts nor will I necessarily provide any support for them. If you
like matlab, you will definitely appreciate Marios'
matlab tips and tricks.
- It's so nice how matlab will subtract a scalar from a matrix for
you without having to call repmat. Here's a little mex function that
will do the same thing for subtracting vectors from matrices matSubVec.c and the help comment and slower
repmat version (used if the mex version isn't compiled) in matSubVec.m.
- If you want to normalize a feature matrix in a hurry, zmuv will make the columns zero-mean,
unit-variance.
- I often find that I need to measure the euclidean distance
between all pairs of points in a couple matrices. The neural net
toolbox includes a dist function, but it is slower and less free than
dist.
- Instead of having to use a dummy first return argument, wouldn't
it be nice to be able to call argmax and argmin directly? You can even nest them inside
another function call. What about the maximum value of a matrix and
its (i,j) coordinates? Use max2, or min2 for the minimum.
- Before matlab 7 came out with its new and improved plotting,
there was no easy way to zoom in only on the x-axis, to pan a graph,
or to zoom and pan all subplots at the same time. zxi handles the zooming, panx
will pan, and scrollx will keep panning until
you tell it to stop.
- Would you like a nice way to specify default arguments to a
function and allow the user to use named arguments? getopts does the job. (I think I might have
gotten the idea for this from a similar function in netlab).
- hist2 will plot nice 2-Dimensional
histograms for you quickly and almost painlessly.
- How about a weighted covariance function? Use
covw and corr will compute a correlation
matrix from your covariance matrix.
- For problems like cross-validation, I often want to select some
feature vectors at random from a large matrix. I use sample to do it.
- Sound.m has soundsc.m, so wouldn't it be nice if wavwrite.m had
wavwritesc?
- It's easy to find the median and mean of the columns of a matrix,
but harder to find the mode.
- For the probabilistically inclined, you might want to sample from
a gaussian mixture model with drawGmm, which
requires the also-useful
drawMultinom.
- Latex tables are a pain to write up by hand, especially if you
need to change the order of two columns.
mat2tex will do it for you.
- For those weka
fans out there, wouldn't you like to be able to turn your feature
matrices directly into arff files? Use
mat2arff.