MATLAB: Delete and handling matrix

cycle for/ifhandlingmatrix

hi,
I have matrix in the insert.I would like:
1) a cycle if/for that if MAtrix(:,8)<3 and matrix(:,6) different zero, delete this line in the matrix.
2)a cycle for/if that IF matrix (:,8)<3 in this lines matrix(:,6) must be 0.
thanks bye

Best Answer

To identify rows of a matrix where column 8 is less than 3 and column 6 is not zero,
rowIdx = (matrix(:,8) < 3) & (matrix(:,6) ~= 0);
where 'rowIdx' is a vector of row numbers that satisfy those conditional statements.
To remove those rows from the matrix,
matrix(rowIdx, :) = [];
To identify rows of at matrix where column 8 is less than 3 and column 6 is equal to zero,
rowIdx2 = (matrix(:,8) < 3) & (matrix(:,6) == 0);