Rename variables in MATLAB

MATLAB version R2011b has just been released. The new format for error messages is not as mind blowing as you might have heard. However, there’s one cute little function that I’ve used already: automated variable renaming.

  • Maybe we’re sharing some code and want to use more descriptive and readable variable names than “x1” and “x2”.
  • Or perhaps we’re reusing code and want to adhere to a different variable naming convention.
  • Or maybe we just picked a stupid variable name when we were whipping something up late at night (I once used “HK” to stand for “high chloride”… it made sense at the time, maybe you can guess why, but it was not a wise choice).
  • In all these cases, this new function is quite useful. A nice addition.