how can i use and take input from two cameras at the same time?
In general working with two cameras is the same as working with a single camera. You create a videoinput object for each device that you wish to capture from and the call start on each device:
vid1 = videoinput('winvideo', 1); vid2 = videoinput('winvideo', 2); start([vid1 vid2]);
These devices will be started at roughly the same time, but will not by synchronized due to delays imposed by the operating system and drivers in actually starting them. To synchronize multiple devices precisely, you generally need to use devices that support hardware triggering.