If you have access to the Image Acquisition Toolbox, you could replace the first line with:
hsrc = imaq.VideoDevice('winvideo', 1, 'MJPG_640x480', ...
'ReturnedColorSpace','grayscale', 'ReturnedDataType','uint8');
You will need to adjust the parameters according to the supported formats by your webcam. Just consult the documentation of the imaq.VideoDevice
function.
Also replace the loop test by just while true
since the video feed is always not done :)