Index error running Psychtoolbox experiment
Dear Community,
I am running my experiment using Psychtoolbox. Unfortunately, I cannot share the whole script here, but generally it’s a centre-out reaching task where my participants use a joystick to reach targets. The joystick trajectory is being tracked with high temporal resolution and saved.
The tasks is presented using Psychtoolbox-3 (3.0.19) running on the MATLAB platform (2021b) in ubuntu (22.04).
The script works somewhat unstable. In 50 percent of cases it runs smoothly without any issues. In the other 50 percent it crushes with the following error message:
Identifier: MATLAB:badsubscript (line 643)
Error: Index in position 1 exceeds array bounds. Index must not exceed 552.
Error in function TextSize: Invalid Window (or Texture) Index provided: It doesn’t correspond to an open window or texture.
Did you close it accidentally via Screen(‘Close’) or Screen(‘CloseAll’) ?
Error using Screen
Usage:
oldTextSize=Screen(‘TextSize’, windowPtr [,textSize]);
Error in C_cued_cursor_rotation_joystick_noCentre (line 727)
Screen(‘TextSize’,wPtr, 40);
Here’s a few lines of my script with line 643 highlighted:
motion(:,9) = [NaN; ((velo/pix_per_mm)/1000)]; %convert velocity units to m/s
%store raw data
trialDat{trial} = motion;
%extract reach data
reachDat{trial} = motion(move_loc:endLoc,:); % LINE 643
%get velocity trend
reachDat{trial}(:,10) = trenddecomp(reachDat{trial}(:,9));
%identify max velocity from trend data
[maxVelo, maxLoc] = max(reachDat{trial}(:, 10));
I’m not a great expert in Matlab unfortunetely. What bugs me is that the script crushes at random time points. Sometimes after 50 trials, sometimes after 450+. And there seems to be nothing different im terms of participant’s performance compared to other trials.
Do you have any ideas what can cause this issue?
And why it doesn’t crush from the very first trial?Dear Community,
I am running my experiment using Psychtoolbox. Unfortunately, I cannot share the whole script here, but generally it’s a centre-out reaching task where my participants use a joystick to reach targets. The joystick trajectory is being tracked with high temporal resolution and saved.
The tasks is presented using Psychtoolbox-3 (3.0.19) running on the MATLAB platform (2021b) in ubuntu (22.04).
The script works somewhat unstable. In 50 percent of cases it runs smoothly without any issues. In the other 50 percent it crushes with the following error message:
Identifier: MATLAB:badsubscript (line 643)
Error: Index in position 1 exceeds array bounds. Index must not exceed 552.
Error in function TextSize: Invalid Window (or Texture) Index provided: It doesn’t correspond to an open window or texture.
Did you close it accidentally via Screen(‘Close’) or Screen(‘CloseAll’) ?
Error using Screen
Usage:
oldTextSize=Screen(‘TextSize’, windowPtr [,textSize]);
Error in C_cued_cursor_rotation_joystick_noCentre (line 727)
Screen(‘TextSize’,wPtr, 40);
Here’s a few lines of my script with line 643 highlighted:
motion(:,9) = [NaN; ((velo/pix_per_mm)/1000)]; %convert velocity units to m/s
%store raw data
trialDat{trial} = motion;
%extract reach data
reachDat{trial} = motion(move_loc:endLoc,:); % LINE 643
%get velocity trend
reachDat{trial}(:,10) = trenddecomp(reachDat{trial}(:,9));
%identify max velocity from trend data
[maxVelo, maxLoc] = max(reachDat{trial}(:, 10));
I’m not a great expert in Matlab unfortunetely. What bugs me is that the script crushes at random time points. Sometimes after 50 trials, sometimes after 450+. And there seems to be nothing different im terms of participant’s performance compared to other trials.
Do you have any ideas what can cause this issue?
And why it doesn’t crush from the very first trial? Dear Community,
I am running my experiment using Psychtoolbox. Unfortunately, I cannot share the whole script here, but generally it’s a centre-out reaching task where my participants use a joystick to reach targets. The joystick trajectory is being tracked with high temporal resolution and saved.
The tasks is presented using Psychtoolbox-3 (3.0.19) running on the MATLAB platform (2021b) in ubuntu (22.04).
The script works somewhat unstable. In 50 percent of cases it runs smoothly without any issues. In the other 50 percent it crushes with the following error message:
Identifier: MATLAB:badsubscript (line 643)
Error: Index in position 1 exceeds array bounds. Index must not exceed 552.
Error in function TextSize: Invalid Window (or Texture) Index provided: It doesn’t correspond to an open window or texture.
Did you close it accidentally via Screen(‘Close’) or Screen(‘CloseAll’) ?
Error using Screen
Usage:
oldTextSize=Screen(‘TextSize’, windowPtr [,textSize]);
Error in C_cued_cursor_rotation_joystick_noCentre (line 727)
Screen(‘TextSize’,wPtr, 40);
Here’s a few lines of my script with line 643 highlighted:
motion(:,9) = [NaN; ((velo/pix_per_mm)/1000)]; %convert velocity units to m/s
%store raw data
trialDat{trial} = motion;
%extract reach data
reachDat{trial} = motion(move_loc:endLoc,:); % LINE 643
%get velocity trend
reachDat{trial}(:,10) = trenddecomp(reachDat{trial}(:,9));
%identify max velocity from trend data
[maxVelo, maxLoc] = max(reachDat{trial}(:, 10));
I’m not a great expert in Matlab unfortunetely. What bugs me is that the script crushes at random time points. Sometimes after 50 trials, sometimes after 450+. And there seems to be nothing different im terms of participant’s performance compared to other trials.
Do you have any ideas what can cause this issue?
And why it doesn’t crush from the very first trial? psychtoolbox MATLAB Answers — New Questions