Global frame counter and accurate timing programming
Show older comments
Dear members
I am currently programming for a very timing-snsitive experiment. I was wondering whether there is a way to setup a global frame counter, which starts upon the program initiated, keeps counting till the program terminated, so that I could check and specify different actions(e.g., present images or text) accourding to the specific frames reached. In other words I am looking for a tic toc timer or internal cpu clock alternative(e.g., using the function GetSecs).
The reason behind trying to sdopt this rather cumbersome method is due to the fact that according to the Accurate timimg demo it seemed better to count the number of frames rather than specify the duration of each event. At the same time, a potential concern for using this frame counting strategy is I am not sure whether dropping frames (perhaps due to hardware limitations) would messed up the sequences entirely. For example, using a 240Hz display dropping 1 frame would advance the entire sequence forward by 1/240 second, as more frames were dropped the effect would accmulate resulting further timing deviations? I am pretty new with this type of programming, perhaps this is a misunderstanding?
Any comments or suggestions would be great! Thanks in advance!
p.s. I am using psychtoolbox for better timing accuracy
8 Comments
Jan
on 15 Feb 2021
What are the "frames" you want to count? I cannot guess, what a "global frame counter" is.
Yu Takahashi
on 16 Feb 2021
Jan
on 16 Feb 2021
Please remember, that the readers do not know anything about what you are doing. I cannot know, what you call "screen refresh" or "flip".
Yu Takahashi
on 16 Feb 2021
Edited: Yu Takahashi
on 16 Feb 2021
Jan
on 17 Feb 2021
We needed an equivalent count and failed to implement it eliably enough in software. Therefore we measured the display frequency externally with a small photo-sensor in a corner of the screen.
Yu Takahashi
on 17 Feb 2021
Walter Roberson
on 17 Feb 2021
There is very slim hope of doing any of this with regular MATLAB; you would either need psychtoolbox facilities or build your own that are similar to psychtoolbox. Psychtoolbox already works are to ensure that screen flips are in synch with monitor refreshes.
Yu Takahashi
on 18 Feb 2021
Answers (0)
Categories
Find more on Timing and presenting 2D and 3D stimuli in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!