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

Re: Finding when x appears in every column

$
0
0
"rebecca girton" wrote in message <mr7csr$eu8$1@newscl01ah.mathworks.com>...
> I am trying to find the first time 0 appears in every column. My matrix is 1000x100 random numbers. So I am trying to find the position of the first '0' in each of the 100 columns. Can anyone help?

Do you mean you have a matrix of random INTEGERS? Otherwise, I'm not sure what you mean by position of first '0' in the column.

If they are integers, then:

[row,col] = find(~X);

will return the row and column subscripts of each zero element in array X. From there, I'll leave it to you to find the first row position in each of the 100 columns (if any).

Viewing all articles
Browse latest Browse all 55

Trending Articles