在我的实验中,我展示了许多不同的光栅。为了节省实验执行期间的时间,我预先绘制了相应的纹理并将它们保存在缓冲区中。但是,这大约需要 10-20 秒,具体取决于运行使用多少刺激,以及机器的速度。
我想知道是否有一种方法可以将预先绘制的纹理存储在硬盘上并让它们读入?
这是当前代码:
tic
stimulus_matrix = [];
for ifrequencies = 1:length(frequencies)
for iphase = 1:length(phases)
for icontrast_manipulation = 1:length(contrast_manipulation)
for icontrast_values = 1:length(contrast_values(1,:))
grating = makeStimulus(contrast_values(icontrast_manipulation,icontrast_values),grating_size_degrees,phases(iphase),frequencies(ifrequencies,1));
stimulus_matrix(ifrequencies,iphase,icontrast_manipulation,icontrast_values) = Screen('MakeTexture', my_window, grating);
Screen('FillOval', stimulus_matrix(ifrequencies,iphase,icontrast_manipulation,icontrast_values), background, CenterRect(ovalRect,gratingRect));
% Display a progress bar during buffering
% code for progress bar removed for clarity
end
end
end
end