Repeat a 2D matrix at multiple places in 5D matrix

조회 수: 2 (최근 30일)
ANAND NALE
ANAND NALE 2021년 8월 20일
댓글: ANAND NALE 2021년 8월 20일
I have a 5D matrix
A = zeros(5,2,2,2,2)
I have another matrix (2D Matrix)
B = [ 1 6
2 7
3 8
4 0
5 10];
Now I need to evaluate:
A(:, :, 2, :, :) = B;
Its shows an error.

채택된 답변

Turlough Hughes
Turlough Hughes 2021년 8월 20일
You could do the following:
A(:, :, 2, :, :) = repmat(B,1,1,1,2,2);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by