zero pad array to multiple of 8
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Elysi Cochin
am 21 Sep. 2021
Bearbeitet: Elysi Cochin
am 21 Sep. 2021
I have array of size A = 429x400, i wanted to pad that array to multiple of 8 such that it becomes A_padded = 432 x 400
Another example,
800 x 533 to 800 x 536
307 x 410 to 312 x 416
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 21 Sep. 2021
A_padded = A;
new_rows = ceil(size(A,1)/8)*8;
new_cols = ceil(size(A,2)/8)*8;
if new_rows ~= size(A,1) || new_cols ~= size(A,2)
A_padded(new_rows, new_cols) = 0;
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Operating on Diagonal Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!