How to name vide files by acquisition start time?

조회 수: 1 (최근 30일)
IJ
IJ 2015년 2월 23일
댓글: Stephen23 2015년 2월 23일
I want to record a number of videos using a loop, and use the start time of each recording as its file name, eg 123050 for 12:30:50. Is there any way I can do that in matlab?

채택된 답변

Stephen23
Stephen23 2015년 2월 23일
편집: Stephen23 2015년 2월 23일
Use now or clock to grab the time value, and then convert this to a string using datestr. You can use datestr's optional formatOut argument to specify how you want the string to look like:
datestr(clock,12)
or
datestr(clock,'HH:MM:SS')
should work
  댓글 수: 2
IJ
IJ 2015년 2월 23일
Thanks for answering, but I am not sure where to put that line in this code (it's part of the loop):
diskLogger = VideoWriter(file_name_here);
vid.DiskLogger = diskLogger;
start(vid)
wait(vid, Inf);
Acquisition is hardware controlled, how do I prevent the time grab as soon as the loop is repeated, even if the video is still waiting for a trigger?
Stephen23
Stephen23 2015년 2월 23일
That depends entirely on which time value you want to use: at the trigger time, the begin or the end of the video sequence? You can try this yourself: try putting that code before start(vid), or before wait or after wait, depending on what time value you are interested in using.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by