how to select particular rows of a column vector repeatedly?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
ANUSHA SOMISETTY
il 8 Ago 2019
Commentato: madhan ravi
il 8 Ago 2019
I have a column vector containing 360 rows(monthly data, 12*10 years=360) and one column. i want to select monthly data of march, april and may of every year. i.e., I need to select 3rd,4th,5th rows for every 12 rows.like that for the 10 years.
Risposta accettata
madhan ravi
il 8 Ago 2019
Modificato: madhan ravi
il 8 Ago 2019
I’m not exactly sure what you mean, perhaps:
vector(repmat([3,4,5],1,10))
edit:
vector(sort([3:12:360,4:12:360,5:12:360]))
2 Commenti
Più risposte (1)
Walter Roberson
il 8 Ago 2019
mask = ismember(mod( (1:12*10) - 1, 12) + 1, [3 4 5]);
YourVector(mask)
The form mod(x-1,N)+1 is a common formula to transform mod(x, N) which woud return 0 1 2 3 ... N-1, into a function that returns 1 2 3 ... N
0 Commenti
Vedere anche
Categorie
Scopri di più su Frequently-used Algorithms in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!