Watch this Author's files
Not sure since which matlab version the following will work, but with version R2011a, you may use a one line code:
set(gcf, 'Position', get(0,'ScreenSize'));
The author seems to be used to c programming language. If implemented with more vector operation, the performance (speed) should be better.