Text file row-column formatting

I have this text file, It contains 3 columns. I want to remove all those rows whose third column element is 0...
So, how to do it..?

 Accepted Answer

Walter Roberson
Walter Roberson on 4 Dec 2012
Edited: Walter Roberson on 4 Dec 2012
YourData = load('3d.txt');
YourData(YourData(:,3) == 0, :) = [];
save('New3d.txt', 'YourData', '-ascii');

2 Comments

It shows this kind of error.
??? Index of element to remove exceeds matrix dimensions.
Sorry I have edited the above to fix the problem.

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!