From: Matt Fig on
I wrote a code to do just this:

http://www.mathworks.com/matlabcentral/fileexchange/24536-expand

expand(M,[1,3])