removing rows in big data

1 回表示 (過去 30 日間)
farfar
farfar 2018 年 6 月 25 日
編集済み: Star Strider 2018 年 6 月 25 日
Hello
I have a big matrix with two columns, for example :[380 1;381 2;382 3;383 4;384 2;385 1;..]. I want to generate a new matrix by removing every three rows.
like at the end I want to have this matrix: [380 1;385 1;390 3;395 4;400 3].
(it is a sample of the real matrix and i want to make it with a five increments rows)
Thank you!

採用された回答

Star Strider
Star Strider 2018 年 6 月 25 日
編集済み: Star Strider 2018 年 6 月 25 日
In your example, your result saves every 5-th row of the input matrix to the output matrix.
Try this:
M = [(380:400)' randi(9, size((380:400)'))] % Create Matrix
Out = M(1:5:end,:)
If you want the result to have every 3-rd row, do this:
Out = M(1:3:end,:)
EDIT Clarifying the discrepancy.
  1 件のコメント
farfar
farfar 2018 年 6 月 25 日
Thank you !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by