필터 지우기
필터 지우기

check with all parameter except its own

조회 수: 1 (최근 30일)
Pratik Anandpara
Pratik Anandpara 2016년 12월 17일
댓글: KSSV 2016년 12월 18일
3 5 1
5 2 2
2 5 2
5 3 1
5 1 3
7 0 2
6 1 2
6 0 3
1 1 7
1 4 4
2 1 6
5 4 0
take 3+5=8--which is not equal to 9
so loop again rotate
take 3+2=5--not equal to 9
same in this manner 5+1=6 not valid 5+5=10 no same as this start from next entry and do process,take allentry as row wise if answer valid than loop stop and do for next element process
  댓글 수: 11
David Barry
David Barry 2016년 12월 17일
Yes I have given up. Poor explanation, no code and no data. I'm out.
Jan
Jan 2016년 12월 17일
I do not understand the explanations also. What do you want to achieve?

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

채택된 답변

KSSV
KSSV 2016년 12월 18일
Let A be your matrix.
B=A(:);
N = length(B);
iwant=zeros(N,2);
for i=1:N
count=0;
C=setdiff(B,B(i));
for j = 1:N-1
count=count+1;
if B(i)+C(j)==10
iwant(i,:)=[B(i) count];
break
end
end
end
  댓글 수: 1
KSSV
KSSV 2016년 12월 18일
count is not required ...You can directly take j in place of count.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by