Matlab

by JS

I’ve recently started to use Matlab for various research purposes. Though aspects of the language seem very useful, I have noticed some interesting particularities.

  1. The mysterious double quote (“). This is a difficult to search for quirk. Some pages seem to indicate that the double quote has some meaning:

    You can also assign pieces of text to variables, not just numbers. You do this using single quotes (not double quotes — single quotes and double quotes have different uses in MATLAB) around the text you want to assign to a variable.

    Other pages indicate otherwise:

    Matlab only supports single quotes, which means parsing errors will occur if you try to use double quotes (e.g. in an Octave script when run on Matlab).

  2. Then there is the issue of indexing. One can select multiple rows and columns using lists of the desired rows and columns: e.g. A(1:10,2:4). However, given a list of coordinates x = [i j], one cannot simply index A(x). This will return the entries contained in rows i and columns j, not the entries (i,j) of A. This seems at odds with logical indexing, which does pull out individual entries: e.g. A(A>5). Of course there is a function for pulling out individual (i,j) entires. One has to call sub2ind(size(A),i,j).
  3. Finally, I sometimes need to run, say 200 or so processes in order to get experimental results. To do so would require ~200 Matlab licenses. That’s a lot of money needed to harness the kind of distributed computing power that characterizes not just research institutions, but many modern business environments (I ran large distributed computational processes even when I had a real job.) In the past I’ve had to port to Octave, which ended up saving me days of waiting for a serial Matlab process to finish.