How to select specific rows in a table ?

314 ビュー (過去 30 日間)
Jenifer NG
Jenifer NG 2022 年 6 月 14 日
コメント済み: Jenifer NG 2022 年 6 月 14 日
Dear All,
I have a table with 200 rows and 2 columns.
Now, I want to select 40 rows with step of 5. row 1 , 5 ,10, 15 ... 200. I try ramsample but it is randoms.
Could any one help me ?
table = randi(200,200,2) % create a maxtrix 1000x2
index = randsample(1:length(table),20)
result = table(index,:)

採用された回答

KSSV
KSSV 2022 年 6 月 14 日
Let T be you table.
idx = 0:5:200 ;
idx(1) = 1 ;
iwant = T(idx,:) ;
  1 件のコメント
Jenifer NG
Jenifer NG 2022 年 6 月 14 日
Thanks it is perfect

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by