how to resample a data from 37 layers to 34 layers?

1 view (last 30 days)
Sreeraj R
Sreeraj R on 16 Nov 2021
Commented: Sreeraj R on 16 Nov 2021
hi
i have a data in the format of 1076x915x37, however for my analysis i need it to be in 1076x915x34. how do i resample the layers in the data?
i tried using resample but didnt quite understand how it worked.

Accepted Answer

KSSV
KSSV on 16 Nov 2021
Edited: KSSV on 16 Nov 2021
Read about interpn.
A = rand(1076,915,34) ;
[m,n,p] = size(A) ;
[X,Y,Z] = ndgrid(1:m,1:n,1:p) ;
[Xi,Yi,Zi] = ndgrid(1:m,1:n,linspace(1,p,37)) ;
B = interpn(X,Y,Z,A,Xi,Yi,Zi) ;

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!