I have data in a time table with around 10 variables. occasionally the data source "stalls out" and just keeps outputting the last value instead of fresh data in a particular column. The timestamp and some columns will update correctly. What I want to do is replace the stale / repeated values with NaN. I can't just remove the row as I need the other columns. When the data is good there would never be a case where the same value repeats twice or more in a row.
data.Var1 = [ 3 , 2, 5, 4, 4 , 4, 4, 6, 2, 3 , 5, 5 ,5 ,5 ]
data.Var1 = [ 3 , 2, 5, 4, NaN , NaN, NaN, 6, 2, 3 , 5, NaN , NaN ,NaN ]
I saw something in a previous post (https://www.mathworks.com/matlabcentral/answers/216921-need-to-remove-repeated-adjacent-elements-in-an-array?s_tid=srchtitle ) that could work but I'm struggling to modify it for my needs as it removes values, once I put in NaN the test doesnt know where the last good value was.
I'd consider upgrading if theres a function in a newer version or toolbox.