MATLAB: How to find first row with a nonzero element in an image matrix

findimagematrixrow

I am trying to find the first row in an image matrix with a non zero value in it.
PLS&THANK YOU!

Best Answer

find(any(any(YourImage, 3),2),1,'first')