a hint:- look at this nice contribution by stuart mcgarrity
http://www.mathworks.com/matlabcentral/fileexchange/2262
us