Text file row-column formatting

1 次查看(过去 30 天)
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..?

采纳的回答

Walter Roberson
Walter Roberson 2012-12-4
编辑:Walter Roberson 2012-12-4
YourData = load('3d.txt');
YourData(YourData(:,3) == 0, :) = [];
save('New3d.txt', 'YourData', '-ascii');
  2 个评论
Lalit Patil
Lalit Patil 2012-12-4
It shows this kind of error.
??? Index of element to remove exceeds matrix dimensions.
Walter Roberson
Walter Roberson 2012-12-4
Sorry I have edited the above to fix the problem.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by