Octave--compare two matrix
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
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
2020년 2월 15일
0 개 추천
M=A(ismember(A,B,"rows"),:)
댓글 수: 7
Walter Roberson
2020년 2월 15일
Is use of double quotes defined in octave?? I do not know.
The octave experts are elsewhere, at a different resource. Octave is a different programming language and not a suitable question for MATLAB Answers.
Les Beckham
2020년 2월 15일
Having been forced to use Octave lately due to not having Matlab available currently, I can answer Walter's question.
Double quoted strings are supported in Octave (and seem to be actually preferred as they are used almost exclusively in the documentation for things like fprintf). I still use single quotes for the most part, as that is what I got used to over the years in Matlab. Strings were just introduced when I lost access to Matlab and I never got into the habit of using them.
Walter is right, of course, that asking Octave questions in Matlab Answers isn't really appropriate.
I really do miss Matlab. :(
Walter Roberson
2020년 2월 15일
Thanks, Les.
Perhaps you could get a Home license?
Michelle Leung
2020년 2월 16일
M=A(ismember(A,B,"rows"),:) works in octave. However, if I also want to compare the column what should I do? I have check M=A(ismember(A,B," column"),:) doesn't work. I am new in using octave and I only have some knowledge on the primary function of creating a matrix and some simple calculations.
Walter Roberson
2020년 2월 16일
Transpose the data you send into ismember so that the column you want to compare becomes a row for the purpose of comparing.
Michelle Leung
2020년 2월 16일
Yeah, I got it!! Thanks, Roberson
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개)
카테고리
도움말 센터 및 File Exchange에서 Octave에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
