필터 지우기
필터 지우기

Using the find function

조회 수: 1 (최근 30일)
Anthony
Anthony 2012년 4월 20일
A= magic(4)
for z= 1:4
position(z) = find(A(:,z)>10,1)
end
I want to use the find function to find all the values greater than 10 . this will enable me use the command A(position) to get all the values greater than 10 in a matrix. Is this possible with matlab?

채택된 답변

Thomas
Thomas 2012년 4월 20일
A= magic(4)
[row,col]=find(A>10)
should give you all positions of values in a Which are > 10
To find the actual values in A which are > 10 use
A(A>10)
ans =
16.00
11.00
14.00
15.00
13.00
12.00

추가 답변 (1개)

Anthony
Anthony 2012년 4월 20일
Thank you Thomas. The reason I am looking for the position is because I want to use these positions to access other values in a matrix named Zone. Zone is defined by: Zone = [3 5 7 9; 4 7 8 2; 4 6 7 8; 5 1 3 2]
So how do I relate the positions from A to the values I want in Zone? basically what I want from Zone is [3,7,1,3,9,8]. Is this possible?
  댓글 수: 1
Thomas
Thomas 2012년 4월 20일
Zone(A>10)
should do the trick..

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

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by