Padding zeros at the end row of a matrix

2 ビュー (過去 30 日間)
Meg Cullen
Meg Cullen 2019 年 5 月 17 日
回答済み: Alex Mcaulley 2019 年 5 月 17 日
For a matrix A = Nx2, how to pad [0 0] row at the end of the matrix to make the number of rows divisible by a number d?
example: for A = 9x2 and d = 2 adding 1 [0 0] row at end will make it 10x2

採用された回答

Alex Mcaulley
Alex Mcaulley 2019 年 5 月 17 日
A = [A;zeros(mod(d-mod(size(A,1),d),d),size(A,2))];

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by