フィルターのクリア

Turning doubles of different dimensions in cells

2 ビュー (過去 30 日間)
Sven Krasel
Sven Krasel 2020 年 5 月 5 日
コメント済み: Sven Krasel 2020 年 5 月 6 日
temp = [time, Dynamics];
temp = num2cell([temp{:}]);
Hey guys,
I have a 1x6 cell called temp. It contains doubles with different dimensions:
double 222x1 double 222x1 double 222x1 double 222x1 double 222x1 double 151x1
Is there a way to 'trick' the num2cell function to the make the temp cell look like being made of consistent dimensions?
Thanks a lot for your help! :-)
Best,
Sven

採用された回答

Image Analyst
Image Analyst 2020 年 5 月 5 日
I can think of two ways
  1. Create a matrix with a height of the tallest vector, and then paste the vectors in. Short vectors will have zeros below them in their column.
  2. Interpolate the short vectors to be the same length as the taller ones using interp1() spline() or similar functions.
Would any of those methods suffice?
  7 件のコメント
Image Analyst
Image Analyst 2020 年 5 月 6 日
If you're going to get each max, and compare it to the current max, you need to have a current max for the very first time you do that. So for the very first time, before you've even looked at any of your variable values, what would be a good value to compare it against such that your first variable value will be guaranteed to be the max so far? Minus infinity of course. Any value you have is certainly guaranteed to be greater than minus infinity, right?
Sven Krasel
Sven Krasel 2020 年 5 月 6 日
Hey Image Analyst,
that's a total reasonable explanation. Thanks for that. Also Method 1 works perfectly and does exactly what I want. Thank you very much!
Cheers,
Sven

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by