You can use a loop to acquire images from the webcam and convert them to gray-scale and then display them in a figure.
See this documentation for more details:
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!