I have a matrix that is:
matrix = [1, 0, 0;
0, 1, 1;
0, 0, 1];
I want to iterate through the matrix column by column and get the row number of the first 1
occurred in that column. So, the result is supposed to be:
[1, 2, 2]
What I have idea so far is:
for i = matrix
if i == 1
%store the row No. to an array.
end
end