Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SideOutcomePlot error
#1
Hi,

I'm having a problem with the SideOutcomePlot. When running my protocol, I surprisingly get the following errors:

Index exceeds matrix dimensions.

Error in SideOutcomePlot (line 101)
        Xdata = FutureTrialsIndx; Ydata =
        SideList(Xdata);

Error in Test1 (line 106)

        SideOutcomePlot(BpodSystem.GUIHandles.OutcomePlot,'update',BpodSystem.Data.nTrials+1,2-TrialTypes,Outcomes)

Error in run (line 96)
evalin('caller', [script ';']);

Error in NewLaunchManager>LaunchProtocol (line 702)
run(ProtocolPath);
 
Error while evaluating DestroyedObject Callback

Code:
%SideOutcomePlot  
BpodSystem.ProtocolFigures.OutcomePlotFig = figure('Position', [50 50 1000 163],'name','Outcome plot','numbertitle','off', 'MenuBar', 'none', 'Resize', 'on'); % Create a figure for the outcome plot
BpodSystem.GUIHandles.OutcomePlot = axes('Position', [.075 .3 .89 .6]);        % Create axes for the outcome plot
SideOutcomePlot(BpodSystem.GUIHandles.OutcomePlot,'init',2-TrialTypes);



for currentTrial=1:MaxTrials
...
Outcomes = zeros(1,BpodSystem.Data.nTrials);
    for x = 1:BpodSystem.Data.nTrials
      if ~isnan(BpodSystem.Data.RawEvents.Trial{currentTrial}.States.Reward(1))
          Outcomes(currentTrial) = 1;
          else
          Outcomes(currentTrial) = 3;
      end
    end
..        
SideOutcomePlot(BpodSystem.GUIHandles.OutcomePlot,'update',BpodSystem.Data.nTrials+1,2-TrialTypes,Outcomes)

I added the relevant piece of the code. Somehow, it does not work. For example, when running 100 trials; it automatically stops at 78th trial. In parallel, when running 200 trials, the protocol stops at 178th trial. Do you know what is wrong here? 

Thanks
Reply
#2
Hi Hana

Thanks for the bug report!
I'm not sure what the issue is, sounds like it has trouble getting to the end of the plot. 
For now you can work around it by doing:

Code:
MaxTrials = 1000;
nTrialsInMySession = 100;

...

for currentTrial = 1:nTrialsInMySession

% Run my trial

end

That way, the plugin always has enough future trials to plot.
The ideal behavior is for its 'stick point' at ~2/3 along the X axis to become unstuck as you approach the last few trials, so the plugin doesn't try to plot future trials. Hopefully we'll have a chance to fix this at some point soon.

Thanks again for posting!
-Josh
Reply


Forum Jump: