interpolation of a structure array

조회 수: 2 (최근 30일)
Josh Tome
Josh Tome 2022년 11월 28일
댓글: Josh Tome 2022년 11월 29일
Hello, I have a structure array which consists of 39 variables (LFHD, RFHD, etc.) Each of those variables contains 3 double arrays of size 1 x ?. I would like to interpolate those double arrays from 1 x ? to 1 x 101 (0-100%) so that they are all the same length and I can average across them.
I am a bit of a MATLAB novice. Any assistance would be greatly appreciated.

채택된 답변

Matt J
Matt J 2022년 11월 28일
fcn=@(f)interp1(f, linspace(1,numel(f),101) );
for i=1:numel(TrajXLstance)
TrajXLstance(i) = structfun(fcn, TrajXLstance(i),'uni',0);
end
  댓글 수: 6
Matt J
Matt J 2022년 11월 29일
Try this insead,
fcn=@(f)interp1(f.', linspace(1, size(f,2) ,101) ).';
Josh Tome
Josh Tome 2022년 11월 29일
Yes, that seems to work. Thanks again for your help!

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by