Octave--compare two matrix

12 ビュー (過去 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 Center および File ExchangeOctave についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by