How to define one cycle from my data by taking the max value??

1 回表示 (過去 30 日間)
Christine Nee
Christine Nee 2017 年 8 月 1 日
コメント済み: Star Strider 2017 年 8 月 1 日
Right now I am taking a .txt file and have defined f as a whole column from the .txt file that was extracted from a DAQ in labview. My code isn't working and the error says:
"Subscript indices must either be real positive integers or logicals."
I read some questions and threads about this already but the fixes didn't work for me.
[Max_Value_Force,maxI] = max(f(:))
Time_Max_Force = t(maxI)
onecycle = f((Time_Max_Force-25):(Time_Max_Force+25))
Thank you so much.

採用された回答

Star Strider
Star Strider 2017 年 8 月 1 日
Try this:
onecycle = f((maxI-25):(maxI+25));
Indices in MATLAB must be integers greater than zero. I am assuming her that ‘maxI’ is greater than or equal to 26, and is at least 26 less than the length of your ‘f’ vector.
  4 件のコメント
Christine Nee
Christine Nee 2017 年 8 月 1 日
You're a rockstar! Thanks!
Star Strider
Star Strider 2017 年 8 月 1 日
Thank you! As always, my pleasure!

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

その他の回答 (1 件)

Matt J
Matt J 2017 年 8 月 1 日
編集済み: Matt J 2017 年 8 月 1 日
onecycle = f( abs(t-Time_Max_Force)<=25 )

カテゴリ

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