Storing numbers with lots of decimal places in arrays

2 ビュー (過去 30 日間)
HC98
HC98 2023 年 6 月 6 日
回答済み: Star Strider 2023 年 6 月 6 日
I'm mmeasring some quantities using an analysis script and appending each one to a dummy array manually with
amplitude = [NaN, 1.395885890803748, 1.859485977632194, NaN, 2.887315445928234,...
NaN, NaN, NaN, NaN, NaN, NaN]
Surely there must be a more efficient way to do this?
  1 件のコメント
Matt J
Matt J 2023 年 6 月 6 日
Maybe, but we can't see what your script is doing now.

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

回答 (1 件)

Star Strider
Star Strider 2023 年 6 月 6 日
Lacking detail as to what the analysis script does or what (if anything) it needs as input, I would put any input variables in an array (vector or matrix), put the ‘analysis script’ in a loop, and then supply each input iteratively in each iteration of the loop, and save the output of the ‘analysis script’ to a vector or matrix in each iteration.
Alternatively, create a function from the ‘analysis script’, call the function in each iteration of the loop, and save the output to a vector or matrix.

カテゴリ

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

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by