Hi,
I've got an output vector from simulink that has dimensions of 25560x1. There are 100 individual cycles within this data and I am trying to get an average of all of them. I am using the attached code to isolate each 256 cycle element, add it together, and then divide to achieve the average. However, I keep getting an error about exceeding array elements. Is there a better way to "squash" this 25560 array into a 256 array with the data being averaged? Thank you.
Bat10Count = round(25560/100);
TotalBatteryP10_293(x)=(BatteryS10_293(x)+BatteryS10_293(Bat10Count+x)+BatteryS10_293(2*Bat10Count+x)+BatteryS10_293(3*Bat10Count+x)+BatteryS10_293(4*Bat10Count+x)+BatteryS10_293(5*Bat10Count+x)+BatteryS10_293(6*Bat10Count+x)+BatteryS10_293(7*Bat10Count+x)+BatteryS10_293(8*Bat10Count+x)+BatteryS10_293(9*Bat10Count+x)+ BatteryS10_293(10*Bat10Count+x)+BatteryS10_293(11*Bat10Count+x)+BatteryS10_293(12*Bat10Count+x)+BatteryS10_293(13*Bat10Count+x)+BatteryS10_293(14*Bat10Count+x)+BatteryS10_293(15*Bat10Count+x)+BatteryS10_293(16*Bat10Count+x)+BatteryS10_293(17*Bat10Count+x)+BatteryS10_293(18*Bat10Count+x)+BatteryS10_293(19*Bat10Count+x)+BatteryS10_293(20*Bat10Count+x)+BatteryS10_293(21*Bat10Count+x)+BatteryS10_293(22*Bat10Count+x)+BatteryS10_293(23*Bat10Count+x)+BatteryS10_293(24*Bat10Count+x)+BatteryS10_293(25*Bat10Count+x)+BatteryS10_293(26*Bat10Count+x)+BatteryS10_293(27*Bat10Count+x)+BatteryS10_293(28*Bat10Count+x)+BatteryS10_293(29*Bat10Count+x)+BatteryS10_293(30*Bat10Count+x)+BatteryS10_293(31*Bat10Count+x)+BatteryS10_293(32*Bat10Count+x)+BatteryS10_293(33*Bat10Count+x)+BatteryS10_293(34*Bat10Count+x)+BatteryS10_293(35*Bat10Count+x)+BatteryS10_293(36*Bat10Count+x)+BatteryS10_293(37*Bat10Count+x)+BatteryS10_293(38*Bat10Count+x)+BatteryS10_293(39*Bat10Count+x)+BatteryS10_293(40*Bat10Count+x)+BatteryS10_293(41*Bat10Count+x)+BatteryS10_293(42*Bat10Count+x)+BatteryS10_293(43*Bat10Count+x)+BatteryS10_293(44*Bat10Count+x)+BatteryS10_293(45*Bat10Count+x)+BatteryS10_293(46*Bat10Count+x)+BatteryS10_293(47*Bat10Count+x)+BatteryS10_293(48*Bat10Count+x)+BatteryS10_293(49*Bat10Count+x)+BatteryS10_293(50*Bat10Count+x)+BatteryS10_293(51*Bat10Count+x)+BatteryS10_293(52*Bat10Count+x)+BatteryS10_293(53*Bat10Count+x)+BatteryS10_293(54*Bat10Count+x)+BatteryS10_293(55*Bat10Count+x)+BatteryS10_293(56*Bat10Count+x)+BatteryS10_293(57*Bat10Count+x)+BatteryS10_293(58*Bat10Count+x)+BatteryS10_293(59*Bat10Count+x)+BatteryS10_293(60*Bat10Count+x)+BatteryS10_293(61*Bat10Count+x)+BatteryS10_293(62*Bat10Count+x)+BatteryS10_293(63*Bat10Count+x)+BatteryS10_293(64*Bat10Count+x)+BatteryS10_293(65*Bat10Count+x)+BatteryS10_293(66*Bat10Count+x)+BatteryS10_293(67*Bat10Count+x)+BatteryS10_293(68*Bat10Count+x)+BatteryS10_293(69*Bat10Count+x)+BatteryS10_293(70*Bat10Count+x)+BatteryS10_293(71*Bat10Count+x)+BatteryS10_293(72*Bat10Count+x)+BatteryS10_293(73*Bat10Count+x)+BatteryS10_293(74*Bat10Count+x)+BatteryS10_293(75*Bat10Count+x)+BatteryS10_293(76*Bat10Count+x)+BatteryS10_293(77*Bat10Count+x)+BatteryS10_293(78*Bat10Count+x)+BatteryS10_293(79*Bat10Count+x)+BatteryS10_293(80*Bat10Count+x)+BatteryS10_293(81*Bat10Count+x)+BatteryS10_293(82*Bat10Count+x)+BatteryS10_293(83*Bat10Count+x)+BatteryS10_293(84*Bat10Count+x)+BatteryS10_293(85*Bat10Count+x)+BatteryS10_293(86*Bat10Count+x)+BatteryS10_293(87*Bat10Count+x)+BatteryS10_293(88*Bat10Count+x)+BatteryS10_293(89*Bat10Count+x)+BatteryS10_293(90*Bat10Count+x)+BatteryS10_293(91*Bat10Count+x)+BatteryS10_293(92*Bat10Count+x)+BatteryS10_293(93*Bat10Count+x)+BatteryS10_293(94*Bat10Count+x)+BatteryS10_293(95*Bat10Count+x)+BatteryS10_293(96*Bat10Count+x)+BatteryS10_293(97*Bat10Count+x)+BatteryS10_293(98*Bat10Count+x)+BatteryS10_293(99*Bat10Count+x))/100;