필터 지우기
필터 지우기

how to duplicate rows in a 2D matrix

조회 수: 1 (최근 30일)
Naufal Arfani
Naufal Arfani 2021년 1월 7일
답변: KSSV 2021년 1월 7일
hello everyone, for example I have an array like the one below, I want to duplicate the array value on row 2nd to the value on row 1st does anyone know the easy way? I have tried the code below but it still has an error, thank you
A = magic(4);
A(2,:) = [1,:];
end

채택된 답변

KSSV
KSSV 2021년 1월 7일
A = magic(4);
A(2,:) = A(1,:)
A = 4×4
16 2 3 13 16 2 3 13 9 7 6 12 4 14 15 1

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