Interpolate between columns within matrix to remove glitched data

조회 수: 3 (최근 30일)
demos serghiou
demos serghiou 2022년 10월 26일
댓글: Mathieu NOE 2022년 10월 26일
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
Mathieu NOE
Mathieu NOE 2022년 10월 26일
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)

댓글을 달려면 로그인하십시오.

채택된 답변

Voss
Voss 2022년 10월 26일
% 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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by