interpolation of a structure array

7 ビュー (過去 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 Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by