How to delete every alternate rows?
27 ビュー (過去 30 日間)
古いコメントを表示
Hi,
In the attached array sz, I need to delete every alternate rows starting from first row, (e.g. 1, 3, 5, 7 etc). Could someone help?
1 件のコメント
Dyuman Joshi
2024 年 4 月 5 日
You have been active here since 2020, I am really surprised that you had to ask for this.
採用された回答
Ayush Anand
2024 年 4 月 5 日
Hi,
You can do
sz_new = sz(2:2:end, :);
This will do the job.
4 件のコメント
Aquatris
2024 年 4 月 5 日
Alternatively you can also delete them from your current variable:
x = 1:10;
x % show x
x(1:2:end) = [];% delete odd idx values
x % show x after removing odd values
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Install Products についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!