One can auto indent all code in a .m file by typing ctrl+A followed by ctrl+I. However, this requires selecting all code which in my MATLAB IDE (R2011a, Linux, with Windows Shortcuts) moves the cursor to the end of the .m file. I then have to scroll back to where I was working.
Is there a way to autoindent an entire .m file without moving the cursor to the end of the file?
Many modern IDEs and text editors, including MATLAB, support the keyboard shortcut of Ctrl+g for the "Go to line #" command.
I would therefore suggest simply remembering the line number you were on, and just coming back to it using the aforementioned shortcut after applying the indent the way you described.