Array out of range

 
          
           double BARS[][24];
           
           void OnStart()

           int size_bars = ArrayRange(BARS,0);
          
           Print(size_bars);  //prints 0
           
           int size_bars_new = ArrayResize(BARS,size_bars+1);
           
           Print(size_bars_new);  //prints 24
          
           Print(TimeHour(time1)); //prints 22
           
           BARS[size_bars_new-1][TimeHour(time1)]= bars ; //gives out of range error
           }  


Hi guys, what am I missing here?  The docs say ArrayResize sizes the first dimension yet I get this error. Any pointers as to where I go wrong are appreciated. Thanks!

 
           
           int size_bars_new = ArrayResize(BARS,size_bars+1);

= 24 elements, 1st dimension is 1

           
           BARS[size_bars_new-1][TimeHour(time1)]= bars ; //gives out of range error

 

 You are trying to access element 23 of the 1st dimension. The 1st dimension only contains 1 element

Reason: