Finding the largest index in an array that is divisible by a certain number
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
Given an nx1 array, I'm trying to get matlab to determine the largest index value which is divisible by a number (say 3), and then have matlab truncate the array to that point.
Any suggestions?
Thanks, Charles
0 件のコメント
採用された回答
Walter Roberson
2013 年 5 月 23 日
divisor = 3;
new_array = old_array(1 : end - mod(end,divisor));
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!