Repeat 3D matrix in 4D

조회 수: 11 (최근 30일)
Mantas Vaitonis
Mantas Vaitonis 2018년 7월 18일
댓글: Mantas Vaitonis 2018년 7월 18일
Hello,
I suppose it is not hard, but I need to repeat 3D matrix a (NxMxL) in to 4D b (NxMxMxL). What I need is to repeat each 2D page of 3D matrix M times (which is columns) in 4D. If try:
b=repmat(a,1,1,1,L) ;
Result is b (NxMxLxL), what would be the correct way to do this?

채택된 답변

Walter Roberson
Walter Roberson 2018년 7월 18일
b = repmat( reshape(a, size(a,1), size(a,2), 1, size(a,3)), 1, 1, size(a,2), 1);
  댓글 수: 1
Mantas Vaitonis
Mantas Vaitonis 2018년 7월 18일
Yes this is exactly what I need.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by