Octave--compare two matrix

조회 수: 7 (최근 30일)
Michelle Leung
Michelle Leung 2020년 2월 15일
댓글: Rik 2020년 2월 16일
How can I insert the row of matrix A into matrix M if the whole row of matrix A and matrix B are the same?
There is the example
>> A = [1 2; 3 4]
A =
1 2
3 4
>> B = [1 2; 3 6]
B =
1 2
3 6
M =
1 2

채택된 답변

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2020년 2월 15일
M=A(ismember(A,B,"rows"),:)
  댓글 수: 7
Michelle Leung
Michelle Leung 2020년 2월 16일
Yeah, I got it!! Thanks, Roberson
Rik
Rik 2020년 2월 16일
Note that Matlab and Octave are sufficiently similar that basic tutorials will work for both. There are several places you can find the most important syntax differences. One of them you encountered here: single and double quotes are interchangeable in Octave, in Matlab they are not.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by