Watch this Author's files
Great function, provided perfect solution first time around! Many thanks
Contact us at files@mathworks.com