Random sample, I want the 5% of the data per each hour
Mostra commenti meno recenti
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 Commenti
Scott MacKenzie
il 4 Giu 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
il 4 Giu 2021
Risposta accettata
Più risposte (1)
KSSV
il 4 Giu 2021
Let A be your data matrix.
[m,n] =size(A) ;
p = round(5/100*m) ;
idx = randsample(m,n) ;
iwant = A(idx,:)
Categorie
Scopri di più su Time Series Events in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!