How do I exclude certain columns from rmmissing rmoutliers?
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Youssef
el 18 de Mayo de 2023
Comentada: Star Strider
el 18 de Mayo de 2023
HI, I have a university assignment and I want to remove missing data and outliers, but there are some columns that I dont want to be affected by this. Is there any way to do that?
0 comentarios
Respuesta aceptada
Star Strider
el 18 de Mayo de 2023
Editada: Star Strider
el 18 de Mayo de 2023
I would treat those as two separate operations.
First, remove the missing data on the entire matrix, not only selectyed columns, The reason for this is to keep the matrix column lengths the same, and so all the rows with non-missing data remain the same.
Removing the outliers is similar.
I would instead use fillmissing for the missing data, and then selectively use filloutliers for the columns you want to process with it. This keeps the matrix structure intact.
To select the columns, just choose the ones you want to process —
A = randn(10, 7);
A(randi(numel(A),1,10)) = 10*randn(1,10)
Afilloutliers = filloutliers(A(:,[2 5 7]), 'linear','grubbs')
Aedited = A;
Aedited(:,[2 5 7]) = Afilloutliers;
figure
plot(1:10, A)
grid
ylim([-50 50])
figure
plot(1:10, Aedited)
grid
ylim([-50 50])
EDIT — (18 May 2023 at 19:00)
Added example.
.
4 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Tables en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

