matlabsynchronizetimetable

Matlab synchronize Timetables with logical content


I'm trying to synchronize different timetables in Matlab. These timetables contain machine Data, so there are some rows with doubles, but also integer, categorical and bool.

When I try to synchronize, I get the error,

"All variables in input timetables must support missing values (e.g. floating point, categorical, datetime, duration, or text) when synchronizing using 'default'."

I think this is happening, because there is no NaN in logical arrays, is it?

Any ideas how I can still synchronize these timetables?

Many thanks in advance.


Solution

  • You cannot use the default fill method with logical data. (The error message does hint at this, but it doesn't quite tell you how to fix it). I think you need something like this:

    tt1 = timetable(datetime(2018,11,1), true, 3.0)
    tt2 = timetable(datetime(2018,11,2), false, 4.0)
    synchronize(tt1, tt2, 'union', 'fillwithconstant')
    

    The key piece here is the 'fillwithconstant' part for the "method" - other methods are available.