フィルターのクリア

Deleting rows in a matrix with condition on its column value

1 回表示 (過去 30 日間)
itzhak mal
itzhak mal 2018 年 9 月 26 日
コメント済み: itzhak mal 2018 年 9 月 26 日
Hi there,
I have a text file with about 14 millions rows and 11 columns. On the 11th column, there are values that are really small.. and I want to get rid of the rows that their 11th column has a value that is smaller than 10^-(12).
I loaded the file into matlab and now it's stored in a variable as a matrix with 14 million rows and 11 columns.. and I wrote this code but it is so painfully slow that it takes it about 1 second per row.. so that's 150 days for the whole matrix.
that's my slow code:
for i = 1 : 13847014
if New_LongDataUn(i,11) < 10^-(12)
New_LongDataUn(i,:) = [];
end
end
Thanks for all the kind help you guys!

採用された回答

James Tursa
James Tursa 2018 年 9 月 26 日
編集済み: James Tursa 2018 年 9 月 26 日
New_LongDataUn(New_LongDataUn(:,11) < 1e-12,:) = [];
  3 件のコメント
James Tursa
James Tursa 2018 年 9 月 26 日
If you mean into a mat file, then simply
save your_matfile_name New_LongDataUn
itzhak mal
itzhak mal 2018 年 9 月 26 日
thanks again! so so much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDatabase Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by