How can I select or extract rows?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Chris
am 5 Sep. 2022
Beantwortet: Star Strider
am 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 Kommentare
Akzeptierte Antwort
Star Strider
am 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Tables finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!