필터 지우기
필터 지우기

Return coordinate of first nonzero element.

조회 수: 2 (최근 30일)
Pramod Bhat
Pramod Bhat 2011년 12월 11일
Hai friends, I have a binary image. I want my function return coordinate of the first nonzero value pixel from a selected row. how to do this ? I had asked the same question ystday also. Someone answered to that. But i wanted coordinates, not indices.
  댓글 수: 2
David Young
David Young 2011년 12월 11일
Please would you explain what you mean by coordinate? How does it differ from the index that the answer to your earlier question gives you?
Jan
Jan 2011년 12월 11일
If you want to specify a question, please either add a comment to the answer or edit the question. Postinmg another thread is worse, because now we have to waste time for searching your earlier question to avoid the creation of an identical answer.
As David has asked already: What is the difference between "coordinate" and "index"?

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

답변 (1개)

Mohsen  Davarynejad
Mohsen Davarynejad 2011년 12월 11일
A=boolean(2*rand(10,10)>1) % Creating a random Matrix
Row = 2; % Assumung you are looking for the first 0 of the row 2.
Colomn = min(find(A(Row,:)))
Coordinates: [Row Colomn]

Community Treasure Hunt

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

Start Hunting!

Translated by