フィルターのクリア

How to remove extra numbers to reduce size of vector?

2 ビュー (過去 30 日間)
Ammy
Ammy 2022 年 3 月 11 日
コメント済み: Ammy 2022 年 3 月 11 日
The following code removes extra number from the start of vector A if the size is not divisible by 3,
I want to remove extra numbers from the end of vector A.
A = rand(10000,1);
s = 3;
shortvector = A((end-s*floor(end/s)+1):end);

採用された回答

KSSV
KSSV 2022 年 3 月 11 日
A = rand(10000,1);
s = 3;
n = mod(length(A),s) ;
iwant = A(1:end-n) ;
  1 件のコメント
Ammy
Ammy 2022 年 3 月 11 日
@KSSV Thank you very much!

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by