How can I select or extract rows?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Chris
le 5 Sep 2022
Réponse apportée : Star Strider
le 6 Sep 2022
I have a 9855 * 1 table indicating months.
Such as
1
1
1
2
2
2
3
3
3
. .
12
12
12
1
1
1
2
2
2
...
How can I select or extract June to August?
0 commentaires
Réponse acceptée
Star Strider
le 6 Sep 2022
It depends on what the data are (for example, datetime arrays).
Given the problem described —
Months = repmat(ones(3,1) * (1:12), 1, 5);
Data = [Months(:) (1:numel(Months)).']
% Check1 = Data(24:36,:)
Result = Data(6 <= Data(:,1) & Data(:,1) <= 8, :)
Check2 = Result(28:36,:)
There are other approaches as well. this is likely the simplest.
.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Tables dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!