I just made a test using Visual Studio Express (which is free, but is a huge package to install, IIRC), and it is able to auto intent the selected text (Edit->Advanced->Format selection). However, I never used that feature, so I don't know how good it works.
If you're already using Matlab for something else, its editor has a "Text->smart indent" command, too. I use this feature for M-files, it works perfectly, and seems to work for C-files, too.
Other free editors I use/used (dev-cpp, Notepad++) don't have automatic recognition and indentation features, AFAIK.