How to use timer?

2 ビュー (過去 30 日間)
Behrad kiani
Behrad kiani 2013 年 11 月 2 日
回答済み: Image Analyst 2013 年 11 月 2 日
I need a code which take a picture in every 2 seconds and do it for 1 minutes. The sodocode is below: For 1 minutes In every 2 seconds { Cam=videoinput(‘winvideo’); }

回答 (1 件)

Image Analyst
Image Analyst 2013 年 11 月 2 日
Why not just put into a loop - that's far simpler than using a timer.
for k = 1 : 30 % Go for 60 seconds (30 snapshots)
snappedImage = getsnapshot(videoObject);
pause(2); % Wait 2 seconds before continuing.
end

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by