In Matlab 2012b, there is a changem function that allows you to substitute elements of a matrix with other values specified by a set of keys:
Substitute values in data array
Is there an elegant/vectorized way to do the same if I don’t have the Mapping toolbox?
Yes, use
ismember:I don’t know
changem, and I suspect the above will not fully cover its functionality (why else would TMW have introducedchangem?), but well, it does what you asked 🙂