Random sample, I want the 5% of the data per each hour
Afficher commentaires plus anciens
I have a database with 19 columns. One column has date, month, year and hour. I would like to get, per each hour, the 5% of the data. Naturaly, I would like to see all the other data, along with the column of time.
Can you help me?
I saw the comand resample, but at the moment, I am in difficulty.
2 commentaires
Scott MacKenzie
le 4 Juin 2021
It would help if you post the data -- or, better yet, a subset of the data -- and any code you have written so far.
Rachele Franceschini
le 4 Juin 2021
Réponse acceptée
Plus de réponses (1)
KSSV
le 4 Juin 2021
Let A be your data matrix.
[m,n] =size(A) ;
p = round(5/100*m) ;
idx = randsample(m,n) ;
iwant = A(idx,:)
Catégories
En savoir plus sur Time Series Events dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!