zero filling of a 4d matrix or how can I copy a matrix in a bigger one without for loops

Hi all I have a huge matrix A (256*256*256*4) and want to dilate this matrix to a bigger matrix B (320*320*320*4) matrix with my original data on the center and zeros around. The only way is to make 'for' loops? JCB

 Risposta accettata

B = zeros(320,320,320,4);
B(33:288,33:288,33:288,:) = A;

Più risposte (1)

Categorie

Community Treasure Hunt

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

Start Hunting!

Translated by