필터 지우기
필터 지우기

How to filter out rows from a very long table

조회 수: 1 (최근 30일)
Reem RA
Reem RA 2022년 7월 14일
댓글: Reem RA 2022년 7월 14일
How can I filter out rows for a huge table? I have pasted bellow a representative sample from the table (I would prefer if this could be done using loops?):
21613 864.52 25 114.0714 -25.8369
21614 864.56 26 114.1197 -26.0363
21615 864.6 27 114.1688 -26.2351
21616 864.64 28 114.2188 -26.4335
21617 864.68 29 114.2697 -26.6313
21618 864.72 30 114.3215 -26.8284
21619 864.76 31 114.3742 -27.0249
21620 864.8 32 114.4279 -27.2206
21621 864.84 33 114.4826 -27.4155
21622 864.88 34 114.5381 -27.6096
21623 864.92 35 114.5943 -27.8027
21624 864.96 36 114.6513 -27.9949
21625 865.00 37 114.7092 -28.1861
21626 865.04 38 114.7681 -28.3762
21627 865.08 39 114.8279 -28.5653
21628 865.12 40 114.8886 -28.7532
21629 865.16 41 114.9503 -28.9399
21630 865.2 42 115.0128 -29.1254
21631 865.24 43 115.0763 -29.3097
21632 865.28 44 115.1406 -29.4926
21633 865.32 45 115.2058 -29.6742
21634 865.36 46 115.2719 -29.8544
21635 865.4 47 115.3387 -30.0332
21636 865.44 48 115.4065 -30.2106
21637 865.48 49 115.4751 -30.3866
21638 865.52 50 115.5445 -30.5611
21639 865.56 51 115.6146 -30.7339
21640 865.6 52 115.6854 -30.9052
21641 865.64 53 115.7568 -31.0749
21642 865.68 54 115.8288 -31.2429
21643 865.72 55 115.9013 -31.4091
%I want the code to say keep row 5, and row 10, and row 15, and row 20, ... and so on
%the table size is 31x5
%I want to have a new table with the resulted new filtered table

채택된 답변

Chunru
Chunru 2022년 7월 14일
a = [
21613 864.52 25 114.0714 -25.8369
21614 864.56 26 114.1197 -26.0363
21615 864.6 27 114.1688 -26.2351
21616 864.64 28 114.2188 -26.4335
21617 864.68 29 114.2697 -26.6313
21618 864.72 30 114.3215 -26.8284
21619 864.76 31 114.3742 -27.0249
21620 864.8 32 114.4279 -27.2206
21621 864.84 33 114.4826 -27.4155
21622 864.88 34 114.5381 -27.6096
21623 864.92 35 114.5943 -27.8027
21624 864.96 36 114.6513 -27.9949
21625 865.00 37 114.7092 -28.1861
21626 865.04 38 114.7681 -28.3762
21627 865.08 39 114.8279 -28.5653
21628 865.12 40 114.8886 -28.7532
21629 865.16 41 114.9503 -28.9399
21630 865.2 42 115.0128 -29.1254
21631 865.24 43 115.0763 -29.3097
21632 865.28 44 115.1406 -29.4926
21633 865.32 45 115.2058 -29.6742
21634 865.36 46 115.2719 -29.8544
21635 865.4 47 115.3387 -30.0332
21636 865.44 48 115.4065 -30.2106
21637 865.48 49 115.4751 -30.3866
21638 865.52 50 115.5445 -30.5611
21639 865.56 51 115.6146 -30.7339
21640 865.6 52 115.6854 -30.9052
21641 865.64 53 115.7568 -31.0749
21642 865.68 54 115.8288 -31.2429
21643 865.72 55 115.9013 -31.4091];
whatyouwant = a(5:5:end, :)
whatyouwant = 6×5
1.0e+04 * 2.1617 0.0865 0.0029 0.0114 -0.0027 2.1622 0.0865 0.0034 0.0115 -0.0028 2.1627 0.0865 0.0039 0.0115 -0.0029 2.1632 0.0865 0.0044 0.0115 -0.0029 2.1637 0.0865 0.0049 0.0115 -0.0030 2.1642 0.0866 0.0054 0.0116 -0.0031
  댓글 수: 1
Reem RA
Reem RA 2022년 7월 14일
Thank you so much, simple and straight forward!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by