MATLAB Answers

Hi All,Remove empty [] entries row in Timetable, rmmissing is not removing rows which have empty entries, Please help, thank you very much

14 ビュー (過去 30 日間)
Amarkant Kumar
Amarkant Kumar 2020 年 2 月 23 日
回答済み: Peter Perkins 2020 年 4 月 14 日
'11-Feb-2020 18:15:00' 174.130000000000 207.300000000000
'11-Feb-2020 18:25:00' 174.130000000000 207.360000000000
'11-Feb-2020 18:35:00' 174.140000000000 []
'11-Feb-2020 18:45:00' 174.130000000000 207.300000000000
'11-Feb-2020 18:55:00' 174.060000000000 207.160000000000
'11-Feb-2020 19:05:00' 174.060000000000 207.080000000000
'11-Feb-2020 19:15:00' 174.030000000000 206.980000000000
'11-Feb-2020 19:25:00' 174.030000000000 206.980000000000
'11-Feb-2020 19:35:00' 174.010000000000 206.920000000000
'11-Feb-2020 19:45:00' 174.020000000000 206.980000000000
'11-Feb-2020 19:55:00' 174.010000000000 206.900000000000
'11-Feb-2020 20:05:00' 174 206.960000000000
'11-Feb-2020 20:15:00' 174.010000000000 206.960000000000
'11-Feb-2020 20:25:00' 174.010000000000 206.960000000000
'11-Feb-2020 20:35:00' 174.040000000000 207
'11-Feb-2020 20:45:00' 174.010000000000 206.980000000000
'11-Feb-2020 20:55:00' 174.010000000000 []
'11-Feb-2020 21:05:00' 174.010000000000 206.920000000000
'11-Feb-2020 21:15:00' 174.010000000000 []
'11-Feb-2020 21:25:00' 173.990000000000 206.940000000000
'11-Feb-2020 21:35:00' 174.010000000000 []
'11-Feb-2020 21:45:00' 174 []
'11-Feb-2020 21:55:00' 174.010000000000 []
'11-Feb-2020 22:05:00' 174 []
'11-Feb-2020 22:15:00' 173.990000000000 206.940000000000
'11-Feb-2020 22:25:00' 173.980000000000 []
'11-Feb-2020 22:35:00' 173.980000000000 []
'11-Feb-2020 22:45:00' 173.950000000000 206.840000000000
'11-Feb-2020 22:55:00' 173.940000000000 206.800000000000

  6 件のコメント

表示 3 件の古いコメント
Amarkant Kumar
Amarkant Kumar 2020 年 2 月 23 日
ohh, I have around 300,000 rows on that timetable, it should need some function to remove empty entries.
thanks

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

採用された回答

darova
darova 2020 年 2 月 23 日
I found a way. FInally!
A = readtable('data.txt','delimiter','\t',...
'ReadVariableNames',false); % without headers
a1 = table2array(A(:,3));
a2 = str2double(a1);
ix = isnan(a2); % detect Non-A-Number
A1 = A(~ix,:); % write without NaN
writetable(A1,'data1.txt','delimiter','\t',...
'WriteVariableNames',false) % without headers

その他の回答 (1 件)

Peter Perkins
Peter Perkins 2020 年 4 月 14 日
Amarkant, this ought to be a very simple operation, something involving rmmissing or maybe something like
t = t(~ismissing(t.Var3),:)
There's no need to do any conversion. But you haven't posted anough to go on. Your original post shows the third column of ... a file? a table? (not a timetable as your title would suggest) ... with [] in some entries, and numbers in others. If that's what your timetable looks like, it implies that the third variable in it is a cell array, which is a bad idea. If you have a timetable that looks like that (except again, what you show is not a timetable, the first variable is text), something is going wrong when you are reading your file. That's where the root of your problem lies.
Post a chunk of the file, this can be solved.

  0 件のコメント

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by