フィルターのクリア

How to extend array from end of that array to known value?

24 ビュー (過去 30 日間)
Tim Fulcher
Tim Fulcher 2021 年 8 月 10 日
コメント済み: Tim Fulcher 2021 年 8 月 10 日
Hi all,
I have an array which ends with 0.3617 but I need to introduce new values which extend that array so that it ends with 0.512. Preferably equally spaced. I'm not bothered with how many elements are added (say 218'ish?). I don't think spacing is all that important because I'll be interpolating afterwards.
Thanks
Tim

採用された回答

Adam Danz
Adam Danz 2021 年 8 月 10 日
編集済み: Adam Danz 2021 年 8 月 10 日
Assuming A is a row vector and you'd like to add 218 values that extend from the end of A to 0.512,
Aextension = linspace(A(end),0.512, 218);
A = [A, Aextension(2:end)];
If you'd like to specify a fixed interval instead of specifying the number of values to add (218),
int = ___ ; % interval
A = [A, A(end)+int : int : 0.512];
however, that does not guarantee that the array will end with 0.512.
  1 件のコメント
Tim Fulcher
Tim Fulcher 2021 年 8 月 10 日
Thanks Adam. That worked a treat.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by