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

9 views (last 30 days)
'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 Comments

Sign in to comment.

Accepted Answer

darova
darova on 23 Feb 2020
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

More Answers (1)

Peter Perkins
Peter Perkins on 14 Apr 2020
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.

Categories

Find more on Historical Contests in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!