interpolation of data takes minutes to operate
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a data of 5068x59 and I want to interpolate each column with respect to column number 4. I have used the below code and its working fine. However, it takes sometime to operate. Therefore, is there any easier way to perform the below tasks
T=readmatrix('1.xlsx');
x = T(:,4) ;
for b=1:width(T)
for bb=1: length(x)
T1(bb,b)=T(bb,b)+ bb*1E-11; %to make all values unique
end
end
distanceQ = 1:max(T1(:,4)); % new distance vector with step size of 1m
for cc=1:width(T1)
speedQ = interp1(T1(:,4),T1(:,cc) , distanceQ);
filename = 'x)Data.xlsx';
writematrix(speedQ,filename,'WriteMode','append')
end
댓글 수: 5
Mathieu NOE
2020년 10월 27일
hi
glad it helped you
I believe the ouput of the interp1 function is a row vector because distanceQ must also be a row vector
you must change the orientation of distanceQ , by putting distanceQ(:) instead of distanceQ in the interp1 function call
so this should give the correct orientation for speedQ:
speedQ(:,cc)= interp1(T2(:,4),T2(:,cc) , distanceQ(:));
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!