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

1 回表示 (過去 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);
  1 件のコメント
ANAND NALE
ANAND NALE 2021 年 8 月 20 日
It works. Thank you

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by