For loop alternative method

3 ビュー (過去 30 日間)
Dharmesh Joshi
Dharmesh Joshi 2022 年 8 月 31 日
コメント済み: Torsten 2022 年 8 月 31 日
Hi
Instead of using a long for loop and if statement, is there alternative method of anylsing a array to on display values which are above or below a certain limit?
For example when sensor is above certain value?
  2 件のコメント
Stephen23
Stephen23 2022 年 8 月 31 日
Logical indexing.
Dharmesh Joshi
Dharmesh Joshi 2022 年 8 月 31 日
Is there any example
For example i have two arrays
SensorA
And
Temperture.
I would like to find all points in SensorA when temperure is below 30 degrees, and then using that data to preform mean, mode ,etc.

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

採用された回答

Torsten
Torsten 2022 年 8 月 31 日
移動済み: Matt J 2022 年 8 月 31 日
SensorA_under_30_degrees = SensorA(Temperature<30)
  2 件のコメント
Dharmesh Joshi
Dharmesh Joshi 2022 年 8 月 31 日
編集済み: Dharmesh Joshi 2022 年 8 月 31 日
Thanks
I will try that.
At the momment i am using:
temp_ind=find(iot_temperture < 30);
no2_comp = iot_no2_we_voltage(temp_ind);
Torsten
Torsten 2022 年 8 月 31 日
And you get an error message ?
Then maybe iot_no2_we_voltage and iot_temperture don't have the same length.
(Shouldn't it be "iot_temperature" instead of "iot_temperture" or did you want to save a character in writing ?)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by