Interpolate between columns within matrix to remove glitched data

3 visualizaciones (últimos 30 días)
Hi, I have a complex matrix where some colums contain glitched data. If columns 25,26 contains glitched data, how can I interpolate between the data in columns 24 and 27 in order to replace columns 25 and 26 within the matrix with the interpolated data?
Thanks
  1 comentario
Mathieu NOE
Mathieu NOE el 26 de Oct. de 2022
hello
have you tried with
if your situation needs more than this advice maybe you should share the data / code that goes along to shw the issue(s)

Iniciar sesión para comentar.

Respuesta aceptada

Voss
Voss el 26 de Oct. de 2022
% a random matrix with 27 columns:
data = rand(10,27);
% glitch columns 25 and 26:
data(:,[25 26]) = NaN;
% show columns 24 to 27 for reference:
data(:,24:27)
ans = 10×4
0.1028 NaN NaN 0.4775 0.1076 NaN NaN 0.9803 0.5539 NaN NaN 0.5751 0.0611 NaN NaN 0.6417 0.9991 NaN NaN 0.8661 0.3203 NaN NaN 0.6451 0.8962 NaN NaN 0.5333 0.5412 NaN NaN 0.8923 0.7979 NaN NaN 0.2805 0.3862 NaN NaN 0.7574
% interpolate based on columns 24 and 27 to get new values for columns 25 and 26:
data(:,[25 26]) = interp1([1 4],data(:,[24 27]).',[2 3]).';
% show new columns 24 to 27:
data(:,24:27)
ans = 10×4
0.1028 0.2277 0.3526 0.4775 0.1076 0.3985 0.6894 0.9803 0.5539 0.5609 0.5680 0.5751 0.0611 0.2546 0.4482 0.6417 0.9991 0.9547 0.9104 0.8661 0.3203 0.4286 0.5368 0.6451 0.8962 0.7752 0.6543 0.5333 0.5412 0.6582 0.7753 0.8923 0.7979 0.6254 0.4529 0.2805 0.3862 0.5100 0.6337 0.7574

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by