How to chang matrix size 81x81x30 to 81x81x32 by add row

1 次查看(过去 30 天)
Hi all....
I have matrix size 81 x 81 x30 ( 3D )
i want to be 81 x 81 x 32
chang size matrix by add 2 row (zero number)
here the example in this file ( daily_avg_u.mat )

采纳的回答

Andrei Bobrov
Andrei Bobrov 2019-1-26
daily_avg_u(:,:,end + (1:2)) = zeros([size(daily_avg_u(:,:,1)),2]);

更多回答(1 个)

Rik
Rik 2019-1-26
You can use the cat function to concatenate arrays in a specific dimension:
A=rand(81,81,30);
B=rand(81,81);
%or: B=zeros(size(A,1),size(A,2),1);
C=cat(3,A,B);

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by