I was able to record video using two webcam simultaneously. But now using same code I am getting error. It is saying that my device is in use but actually it is not. The error is:
Error using videoinput (line 391)
winvideo: The device associated with device ID 2 is already in use. A new videoinput object cannot be created for this device while it is in use.
Error in recording_video1 (line 5)
vid2 = videoinput('winvideo',2, 'YUY2_320x240');