![]() |
Issue with GlobalCounterReset - Printable Version +- Forums (https://sanworks.io/forum) +-- Forum: Bpod (https://sanworks.io/forum/forumdisplay.php?fid=1) +--- Forum: Software (https://sanworks.io/forum/forumdisplay.php?fid=6) +--- Thread: Issue with GlobalCounterReset (/showthread.php?tid=441) |
Issue with GlobalCounterReset - Marike - 09-30-2018 I have been trying to work with global counters and ran into an issue where resetting the counter caused an "Index exceeds array bounds" error message. Attempting to fix it, I tried to run the example code from the documentation, but still ended up with the same error message. The highlighted row is the piece of code that breaks when I attempt to use it. Link to Documentation: https://sites.google.com/site/bpoddocumentation/bpod-user-guide/function-reference-beta/setglobalcounter_beta Code: sma = NewStateMachine(); sma = SetGlobalCounter(sma, 1, 'BNC1High', 5); sma = AddState(sma, 'Name', 'State1', ... % BNC1High Events in this state are not counted because the count will be reset. 'Timer', 1,... 'StateChangeConditions', {'Tup', 'State2'},... 'OutputActions', {}); sma = AddState(sma, 'Name', 'State2', ... % This state resets the global counter. 'Timer', 0,... 'StateChangeConditions', {'Tup', 'State3'},... 'OutputActions', {'GlobalCounterReset', 1}); sma = AddState(sma, 'Name', 'State3', ... 'Timer', 0,... 'StateChangeConditions', {'Port1In', 'State4', 'GlobalCounter1_End', 'exit'},... 'OutputActions', {}); sma = AddState(sma, 'Name', 'State4', ... 'Timer', 0,... 'StateChangeConditions', {'Port1Out', 'State3', 'GlobalCounter1_End', 'exit'},... 'OutputActions', {}); If anyone knows what the problem is, I would appreciate any suggestions. |