Moving off of Matlab for numeric/image processing

Reardon abused me (not really) for still using Matlab and goaded me to look into the ImageJ world. So I am learning. Seems like I need to get smart on

* “ImageJ”: and the “Fiji”: distribution
* Python derivatives like “Jython”: for ImageJ scripting and “NumPy/SciPy”: for numeric/array processing
* There are a ton of other scripting language choices but seems like python covers this well enough. I don’t want the brain damage of “Clojure”:

Other stuff to learn? I’ll have to pick up an editor and source management tool as well. The benefit of all this? Any code I write should be faster, more easily redistributable, and there is a large support community. The disadvantage? I have to assemble all these piece-parts to get something equivalent to MatLab, so more time d&*king around with software which is time taken away from research focus. And the Matlab universe has a pretty good support community too, so not clear I am trading up there. Certainly the ImageJ/Jython/NumPy path is “cooler” along a certain dimension, but do I care?

MATLAB lessons

Doing a ton of MATLAB coding these days. What an amazing tool. For a numbers geek, this is so much better than Excel. The macro language in excel/spreadsheets has always been wacky, and the basic tool in later versions is even worse.

MATLAB is awesome but of course some key lessons that I am relearning, as well as some new ones.

  • Off-by-one errors are killers. Especially when dealing with huge complex matrices. Document and layout your variables carefully.
  • The lack of any variable typing system is a little scary, as well as the lack of required variable declarations. You can get in a lot of trouble easily by declaring variables willy-nilly and doing whatever you want with them. Powerful but a little dangerous.
  • OK, the ability to create variables with the same name as built-in values/functions, and/or the ability to assign values to built-ins without regard to their intended value — well this is just nutso.  And the “lint” tool that is part of the development environment doesn’t make a peep about it. For instance, I used “i” as the index value for a loop. Unfortunately “i” means of course the square root of -1, and when you arbitrarily set this to say 5, bad $h!t happens. Who ever thought it was a good idea to let users do this? Lesson learned.
  • MATLAB is very PL/1 like. OK this doesn’t mean much to most people, but there is a function or library for everything in MATLAB. If it is something you want to do, there is probably already a function or option to do it, you just have to sift thru the function reference to find it.
  • BTW, make sure you change the help search options to span just the libs you have access to. Otherwise everytime you search help, you will get 95% useless information.
  • The lack of even the most primitive source control package in the development environment is ridiculous. It is easy to point the tool at other working directories tho. Short of installing a source control system , clone your working directory often. Really there ought to be some simple versioning in the tool and the ability to rollback.

Matlab on OSX — pay attention to file names

BTW, this is a powerful but incredibly finicky piece of software. It is an X11 app, and I wonder how much that is affecting it.

One thing to watch for is the path length limitation on the names of m files. it is 63 characters total for the full path — that is right, the FULL path. the full path by default is some long path pointing into a MATLAB directory in your documents folder, in my case, 52 characters were already used up. So when i put a nice long name on an M file, I exceeded the 63 limit and got some completely nonsense error message about the file not being on my path. Well ok the error message was true, the truncated filename file wasn’t on any path anywhere, but stupid.

The other thing I’ve noticed is that Matlab really doesn’t like m files whose names begin with a number — ie it just will not run something called “55.m”. you need to start with alpha.

Silly. It’s 2009 guys. These feel like MSDOS restrictions circa 1990.

Installing MatLab on Snow Leopard

Getting myself up to speed on MatLab for this fall’s classes, the activation fails on Snow Leopard with some ugly error message. Fix is easy — in the Java Preferences app on your system, make 32-bit Java the default. All is well after that.

Details on the “matlab support site”: