Watch this Author's files
I had the same problem and found your function. Thanks, Josh, very useful indeed.
Contact us at files@mathworks.com