Function to aggregate data
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have to create a function that takes two vectors as input and string that specifies how to aggrerate the measures in one of the vectors.
One vector contains year,month,day,hour,minute and second for a full year the other four measures. zone1,zone2,zone3,zone4 So they are N*6 and N*4.
If day is choosen i have to aggregate all the measures within the same day. Since i have two seperate vectors i guess i have to put them back together Again ?
But then how do i aggregate the measures within a certain period ? The output has to be one vector containing the start period only, of all the starting month, day or hour. Depending on what is choosen. And another vector with the sum of all the Measurements within the choosen period.
I am so new in this. But i was thinking about using something with Unique ?
I really have no idea.
0 Commenti
Risposte (1)
Yona
il 4 Dic 2014
first you don't need to put them together, you just need to track the line you want and take them from the second matrix (for example in unique you have index; if you use a logic low you can use find) but i think it better to add them together.
you can take all the date (y,m,d,...) and turn it to matlab date by using the function datenum. after this you can use datenum for your range (datenum('2014/12','yyyy/mm'), for example). for example, today (December 4) is 735937. so if you take all line between 735937 to 735938 you will get all data from (December 4).
I don't think unique can help you, i think find is the way to do this. it will find only the line you want and then you can do on this line any "manipulation" you want.
0 Commenti
Vedere anche
Categorie
Scopri di più su Dates and Time in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!