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

조회 수: 1 (최근 30일)
nada
nada 2019년 1월 26일
댓글: Rik 2019년 1월 26일
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일
daily_avg_u(:,:,end + (1:2)) = 0;
works as well and might be clearer as to what is going on

댓글을 달려면 로그인하십시오.

추가 답변 (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