From: Aaron on 12 Jul 2010 10:02 I currently have a data matrix that is 27359x26. This data is all taken at 1 minute intervals, but the time will be variable between different data sets I will be running this script on, so the 27359 will be variable depending on total test time. I am looking to get the average of every 10 rows but cannot seem to figure it out. ie - condense the 1 minute data to 10 minute data by taking every 10 rows and averaging them 1-10,11-20,21-30,etc...) Any help would be greatly appreciated.
From: us on 12 Jul 2010 10:10 "Aaron " <aaron.stender(a)honeywell.com> wrote in message <i1f78s$oae$1(a)fred.mathworks.com>... > I currently have a data matrix that is 27359x26. This data is all taken at 1 minute intervals, but the time will be variable between different data sets I will be running this script on, so the 27359 will be variable depending on total test time. I am looking to get the average of every 10 rows but cannot seem to figure it out. ie - condense the 1 minute data to 10 minute data by taking every 10 rows and averaging them 1-10,11-20,21-30,etc...) > > Any help would be greatly appreciated. a hint: help filter; us
From: Aaron on 12 Jul 2010 13:41 "us " <us(a)neurol.unizh.ch> wrote in message <i1f7ob$qi7$1(a)fred.mathworks.com>... > "Aaron " <aaron.stender(a)honeywell.com> wrote in message <i1f78s$oae$1(a)fred.mathworks.com>... > > I currently have a data matrix that is 27359x26. This data is all taken at 1 minute intervals, but the time will be variable between different data sets I will be running this script on, so the 27359 will be variable depending on total test time. I am looking to get the average of every 10 rows but cannot seem to figure it out. ie - condense the 1 minute data to 10 minute data by taking every 10 rows and averaging them 1-10,11-20,21-30,etc...) > > > > Any help would be greatly appreciated. > > a hint: > > help filter; > > us I've searched and searched but I can't seem to figure out how to use the filter function to my advantage. It seems to me in every example I've found that it is doing a running average (sliding window) whereas I am looking for a simple moving average of 10 seperate points at a time (1-10,11-20,21-30, etc...). Any more hints? I am trying to condense my 27359 data points down by a factor of 10 to 2736 (the last set would only include the average of the last 9 points instead of 10 like the rest then). Thanks for the help.
From: ImageAnalyst on 12 Jul 2010 14:04 Try calling reshape to make it 260 columns wide instead of 26, then call mean(). By the way, your matrix is not a multiple of 10 rows, so you may have to do special things for the last 9 rows..
From: ImageAnalyst on 12 Jul 2010 14:22
data = rand(27360, 26); reshapedData = reshape(data, [2736 260]); means = mean(reshapedData, 2); |