MATLAB: Output rows of a matrix that meet a certain condition to a text file

matrix array

I have a matrix that looks like the following. I want to output all the rows to a text file that have a 5th column value greater than 10.
10 5 4 6 10
4 8 10 4 11
1 8 24 7 9
4 8 22 11 7
5 1 18 2 14
So the text file would look like
4 8 10 4 11
5 1 18 2 14

Best Answer

dlmwrite('mytextfile.txt',m(m(:,5)>10,:),'delimiter',' ') %where m is your given matrix