フィルターのクリア

Assigning indexes in an array and finding max values in a selected range

1 回表示 (過去 30 日間)
FW
FW 2019 年 4 月 26 日
コメント済み: Walter Roberson 2019 年 4 月 26 日
If we have X = time series data and signal in a 8000x 2 array (Matlab 2017b). The first column is time and the second column is signal of light absorbance. How can we find a maximum value in the selected range say from row 4000:5000 of the second column? Additionally, I would to like generate another column within X containing the index of each entry so that it becomes 8000x3 array. Thanks.

採用された回答

Walter Roberson
Walter Roberson 2019 年 4 月 26 日
Assuming that X is a timeseries object (and not a Simulink time series):
rstart = 4000; rend = 5000;
[maxabs, maxidx] = max(X.Data(rstart:rend,2));
maxloc = rstart + maxidx - 1;
data_there = X.Data(maxloc,:);
It is not clear to me what the third column would be an index of?
  4 件のコメント
FW
FW 2019 年 4 月 26 日
Yes please.
Walter Roberson
Walter Roberson 2019 年 4 月 26 日
X.Data(:,3) = 1:size(X.Data,1);

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by