MATLAB: Loop counting problem in matrix

I m new in matlab programming can anyone please give me the code that count a number from a matrix where column 1 have value 1 && column 4 have value 1. thank you

Best Answer

YourMatrix(:, SomeColumn) == SomeValue & YourMatrix(:, SomeOtherColumn) == SomeOtherValue
would give you a vector of 1 and 0 indicating whether the condition held for that row.
With a vector of 1 and 0, how could you count the number of 1's ?