Is it possible to pre-load an animation (e.g. drifting squared wave gratings) so my MATLAB won’t be stuck in the while loop (see attached) during the duration of the animation? The reason I want to do this is that I need MATLAB to work on something else while the animation is playing. I imagine I can put the code for this “something else” in the animation “while” loop but that is going to be pretty bulky and I am afraid the 60-Hz refresh rate will limit the times my “something else” code is executed. I can also imagine using multithreading but that will require me to have the MATLAB Parallel Processing toolbox… Is there an elegant way to do this in PTB? Thanks!
Please see below for my animation “while” loop:
t_start = GetSecs; while GetSecs < t_start + Par.StimDur phase = phase + d_phase; Screen('DrawTexture', Par.PTB.window, texDG, , dstRect, ori, , , , , , [phase, freq, contrast, 0]); Screen('Flip', Par.PTB.window); end