Hi Everyone,
I have uneven matrices, let's say A=2000x2 and B=1900x2. I'm trying to combine them by taking away the last rows of A.
Sometimes B will be the bigger one, in which case i want the last rows of B to be taken away, so that they match in size.
Any help would be greatly appreciated.

 채택된 답변

Matt J
Matt J 2022년 10월 26일
편집: Matt J 2022년 10월 26일

0 개 추천

N=min(size(A,1), size(B,1));
A=A(1:N,:);
B=B(1:N,:);

추가 답변 (1개)

Torsten
Torsten 2022년 10월 26일

0 개 추천

m = min(size(A,1),size(B,1));
A = A(1:m,:);
B = B(1:m,:);

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

질문:

2022년 10월 26일

댓글:

2022년 10월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by