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

2 views (last 30 days)
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

Accepted Answer

madhan ravi
madhan ravi on 14 Mar 2019
dlmwrite('mytextfile.txt',m(m(:,5)>10,:),'delimiter',' ') %where m is your given matrix

More Answers (0)

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!