Octave--compare two matrix

8 次查看(过去 30 天)
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
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