Padding zeros at the end row of a matrix

5 visualizaciones (últimos 30 días)
Meg Cullen
Meg Cullen el 17 de Mayo de 2019
Respondida: Alex Mcaulley el 17 de Mayo de 2019
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

Respuesta aceptada

Alex Mcaulley
Alex Mcaulley el 17 de Mayo de 2019
A = [A;zeros(mod(d-mod(size(A,1),d),d),size(A,2))];

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by