Add zero to make length divisible by 3

4 ビュー (過去 30 日間)
hdiba
hdiba 2016 年 8 月 6 日
コメント済み: hdiba 2016 年 8 月 6 日
Hallo,
i have vector that i want to reshape into a matrix. Therefor i firstly need to prove if the length is divisible by 3. if not i want to add as much zeros at the end of the vector until the length is divisible by 3? can someone help? thanks!

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 8 月 6 日
id=mod(-numel(A),3)
A(end+1:numel(A)+id)=0
  1 件のコメント
hdiba
hdiba 2016 年 8 月 6 日
Thanks a lot!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBlock and Blockset Authoring についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by