Welcome! Log In Create A New Profile

Advanced

Index in position 1 exceeds array bounds

Posted by TapasArakeri 
Index in position 1 exceeds array bounds
April 21, 2022 12:35PM
Hi,
I often keep running into this error when using a joystick to run a task. In the example below I was running the pacman task. I observed the same error with some of my custom adapters as well. I have noticed this error usually after running about 300-500 trials. Any idea what might be going on? Please let me know what details you might need to fix this problem.

Index in position 1 exceeds array bounds (must not exceed 13552).

Error in pacman_script_runtime/end_trial (line 870)
TrialData.AnalogData.Joystick=JoyCal.sig2deg(DAQ.Joystick(ml_SamplePoint,smiling smiley,param_.JoyOffset);

Error in pacman_script_runtime (line 1224)
end_trial();

Error in run_trial (line 130)
runtime(MLConfig,TrialRecord,TaskObject,TrialData);

Error in monkeylogic/UIcallback (line 869)
result = run_trial(MLConfig,datafile);

Error while evaluating UIControl Callback.
Re: Index in position 1 exceeds array bounds
April 22, 2022 04:00AM
Please download the package again. I don't think the number of trials matters here. Let me know how the new package works for you.
Re: Index in position 1 exceeds array bounds
April 22, 2022 03:50PM
Thanks for the reply. Now I am noticing that the error occurs a lot earlier than before- just after a few trials.
Re: Index in position 1 exceeds array bounds
April 23, 2022 12:14AM
The package had a bug that crashed MATLAB at the end of the first trial when running the pac-man task. I wonder how you ran your task. I updated the packages. Please download again. Sorry for the inconvenience.

The error is impossible to occur under a normal condition. I suggested trying the new package, because I finally fixed some overdue issues and thought your problem might be related. Please provide more information.
Re: Index in position 1 exceeds array bounds
April 25, 2022 04:27PM
Thanks for the update! I tried running the pacman task again after downloading the new package, and got the same error after the first trial.
Re: Index in position 1 exceeds array bounds
April 25, 2022 05:52PM
What is the error? Is it the "Index in position 1 exceeds array bounds" error again?

Since I do not see the error you are talking about, you need to give me more information to think about, like what is your DAQ device, what kind of input signals are connected, etc. Also please send me the data file created from the failed task.
Re: Index in position 1 exceeds array bounds
April 27, 2022 06:24PM
I thought up a possible scenario how it might occur and made some changes. Please download the package again and try it.

What is your computer spec, by the way? Is it recently purchased?
Re: Index in position 1 exceeds array bounds
April 28, 2022 03:40PM
Thanks a lot! It seems to be working now. I will let you know if I run into issues.

FYI
The PC that I'm using:
Processor Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz 3.00 GHz
Installed RAM 64.0 GB (63.8 GB usable)
System type 64-bit operating system, x64-based processor

Edition Windows 10 Enterprise
Version 21H2
Installed on ‎2/‎22/‎2021
OS build 19044.1645
Experience Windows Feature Experience Pack 120.2212.4170.0

The PC was not a recent purchase.

The NI DAQ is a PCIe 6321.

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.