reduce samples on a 3d array

조회 수: 9 (최근 30일)
Emmanouil Karamousadakis
Emmanouil Karamousadakis 2021년 8월 26일
댓글: Wan Ji 2021년 8월 29일
I have a 3d matrix containing temperature data. The first 2 dimensions are the the x,y, of my thermal camera, the 3rd dimention represents time.
It is a 160x120x30000. size
I cannot find a way to reduce its 3rd dimension size with some kind of interpolation, loosing data in between not at the ends. I would like to make it 160x120x28000 for example. Any ideas plz? I played aroud with griddedInterpolant and interp1 but I cannot figure it out.
Thank you!!

채택된 답변

Wan Ji
Wan Ji 2021년 8월 26일
편집: Wan Ji 2021년 8월 26일
Use interp1 my friend, if a is the 160x120x30000 data that you said.
[m,n,p] = size(a);
a = reshape(a,m*n,p);
nSeries = p;
totalTime = nSeries - 1;
nSampled = 28000; % loosing data in between with 28000 samples
tSeries = linspace(0,totalTime,nSeries);
tSampled = linspace(0,totalTime,nSampled);
a = interp1(tSeries,a',tSampled);
a = reshape(a',m,n,nSampled); % this is the data resampled 160x120x28000
  댓글 수: 2
Emmanouil Karamousadakis
Emmanouil Karamousadakis 2021년 8월 29일
Thank you!!! It works perfect!!!
Your code is very very easy to understand!!
I appreciate it!
Wan Ji
Wan Ji 2021년 8월 29일
Hi friend, my pleasure the code helped solve your problem! :)

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by