Index exceeds matrix dimensions when running "keyDots"

Dear Psychtoolbox Group,

I am getting the error "Index exceeds matrix dimensions" when I attempt to run the keyDots.m program from the Variable Coherence Random Dot Motion code provided at https://www.shadlenlab.columbia.edu/resources/VCRDM.html
What is the best way to debug the program, and would you happen to know possible indices that might exceed matrix dimensions? 
Thank you, in advance, for your help!
Sarah