필터 지우기
필터 지우기

how to match different values of a matrix

조회 수: 1 (최근 30일)
PRAVEEN GUPTA
PRAVEEN GUPTA 2019년 8월 28일
댓글: Guillaume 2019년 8월 28일
i have a matrix like given below:
X=[1 5 3;
1 5 4;
1 5 3]
i have to compre the elements as X(1,1)=X(2,1)=X(3,1) if its same then result must be that value i.e. (X1=1,X2=5) but if not same then the value must be what is the majority otherwise display erroe
for ex: X(1,3)~=X(2,3)=X(3,3)then X3=3
  댓글 수: 2
Rik
Rik 2019년 8월 28일
What have you tried so far?
PRAVEEN GUPTA
PRAVEEN GUPTA 2019년 8월 28일
i am not getting only for "ex: X(1,3)~=X(2,3)=X(3,3)then X3=3"
first case i have done using if loop

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

채택된 답변

Guillaume
Guillaume 2019년 8월 28일
So basically, you want
mode(X, 1)
  댓글 수: 3
Rik
Rik 2019년 8월 28일
Can you explain why not?
Guillaume
Guillaume 2019년 8월 28일
must be what is the majority
This is the exact definition of mode. Of course, if the values are all the same, that single value is also the mode.
So, indeed as Rik says, explain why not?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by