Deleting erroneous data from a table

1 visualización (últimos 30 días)
James Cross
James Cross el 30 de Nov. de 2022
Respondida: Kartik el 21 de Mzo. de 2023
I have multiple months of data consisting of 96 entries per day. I need a code segment that will allow me to quickly check each day ( 1 thru 31) to see if it in fact has the required number of entries (should be 96). I need to identify these items indices and remove them from ixt.
So far I have this mess: (I changed the daily input to 97 in an attempt to force a reaction). There has to be a better way... since this didn't work.
ixt = find(deviceColumn == deviceNumber);
dailyInput = 97;
data_check = DateTime(ixt);
sampleDays = dateshift(data_check,'start','day');
check_results = groupsummary(table(sampleDays),1);
days_v = height(check_results(:,2));
ixt_indrem = zeros(1,days_v);
counts = table(check_results(:,2));
dailyInput_t = table(96*ones(31,1));
ixt_indremove = setdiff(counts,dailyInput_t);
I tried using ixt_indremove = setdiff(counts,dailyInput_t); but I keep getting this "Error using tabular/union
A and B must both be tables, or both be timetables." which confuses me because my variables "counts" and "dailyInput_t" are both tables of the same size.

Respuestas (1)

Kartik
Kartik el 21 de Mzo. de 2023
Hi,
The error message you are receiving suggests that 'counts' and 'dailyInput_t' are not both tables or timetables, as required by the 'setdiff' function. One way to fix this is to convert both 'counts' and 'dailyInput_t' into ordinary arrays using the 'table2array' function before passing them to 'setdiff'.

Categorías

Más información sobre Tables en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by