Psychtoolbox- Error Using Screen
Show older comments
Hi everyone, I'm encountering an issue with a section of code from a script. It keeps closing out with an error, and I'm not sure why. The error message reads as follows:
Error using Screen
Usage:
Screen('DrawTexture', windowPointer, texturePointer [,sourceRect] [,destinationRect] [,rotationAngle] [, filterMode] [, globalAlpha] [, modulateColor] [, textureShader] [, specialFlags] [,
auxParameters]);
Error in memcongr (line 802)
Screen('DrawTexture', window, leftStimuli{iTrial}, [], LeftPatch{iTrial});
The variables leftStimuli & LeftPatch are defined as:
leftStimuli = cell(1,nruns);
LeftPatch = cell(1,length(rightselection{oldtrialsperrun}));
Also, these variables are defined as:
oldtrialsperrun:
oldtrialsperrun = 5;
luretrialsperrun= 3;
nTrialsTotal = oldtrialsperrun + luretrialsperrun;
rightselection
images_encoding_stim = Shuffle(stimuli);
leftStimuli = cell(1,nruns);
RightStimuli = cell(1,nruns);
% Ensure the equality of the number of stimuli
total_stimuli = length(images_encoding_stim);
half_stimuli = floor(total_stimuli / 2);
% Divide into two groups: right position and left position
rightselection = images_encoding_stim(1:half_stimuli);
leftselection = images_encoding_stim(half_stimuli+1:end);
clear half_stimuli
% Divide for each run (here you get a code with the stimuli you need to present on the right and left sides)
for irun = 1:nruns
stimuliPerRunRight{irun} = {rightselection(1+(irun-1)*oldtrialsperrun : irun*oldtrialsperrun)};
stimuliPerRunLeft{irun} = {leftselection(1+(irun-1)*oldtrialsperrun : irun*oldtrialsperrun)};
end
Thank you very much for everything. I've been stuck with this error for a couple of months. I'm very willing and open to answering questions about any part of the code in order to get it working.
2 Comments
Walter Roberson
on 2 Jul 2024
The code posted does not show setting of leftStimuli or RightStimuli, so as far as we know leftStimuli{iTrial} is an empty cell.
Martín García Montes
on 9 Jul 2024
Accepted Answer
More 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!