Relpace array elements by another array where both array length are not equal?

조회 수: 3 (최근 30일)
Hi all,
I have a Array say A = [0 0; 0 0; 0 0; 0 0; 0 0] i.e. array size 5 by 2
A =
0 0
0 0
0 0
0 0
0 0
I have another Array B = [1 2; 5 7; 3 8] i.e. array size 3 by 2
B =
1 2
5 7
3 8
where both Array A and B are not equal in length.
I want to replace the array elements A by the array elements of B like this
A =
1 2
5 7
3 8
0 0
0 0
# Thanks in advance

채택된 답변

Matt J
Matt J 2021년 4월 26일
A(1:size(B,1),:)=B;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by