Quantcast
Channel: MATLAB Central Newsreader - tag:"find"
Viewing all articles
Browse latest Browse all 55

Re: how to find intersection in image matrix and plot it

$
0
0
"wan azeem" <naieym@yahoo.com> wrote in message <njfcmc$sf1$1@newscl01ah.mathworks.com>...
> Sorry let me rephrase this..finding the intersection between 0 and 1..I'm guessing command 'find'..but I dont quite understand the command..about finding nonzero element..
> and plot the intersection (intersection between black and white if referring to the image so logically between 0 and 1 ) am I right ? Sorry I'm new to matlab..

If you want to find the column index of the first 1 for each row, do this

A = [0 0 0 0 1 1 1 1;
0 0 1 1 1 1 1 1;
0 0 0 0 0 1 1 1;
0 0 0 1 1 1 1 1]

>> [~,loc]=max(A,[],2)

loc =

     5
     3
     6
     4

>>

Viewing all articles
Browse latest Browse all 55

Trending Articles