Data comparison and storing
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
I've created a sensor to take readings daily .
Humidity =
20×1 string array
"34.099045"
"42.425098"
"33.480418"
"35.790796"
"30.370059"
"44.029928"
"49.041827"
"44.980187"
"45.134548"
"40.841782"
<missing>
<missing>
<missing>
<missing>
<missing>
<missing>
<missing>
<missing>
<missing>
<missing>
HumidityTime =
2 24
4 48
7 12
9 36
12 0
14 24
16 48
19 12
21 36
24 0
5 件のコメント
Peng Li
2020 年 3 月 28 日
You question isn’t clear. Without hardcoded value, did you mean that you want to find values between the two numbers you gave?
You humidity time has 10 rows while humidity has 20, it isn’t clear how to match them.
You may want to first convert the humidity string to double using str2double. It will then easier for you to make any math calc.
Walter Roberson
2020 年 3 月 29 日
In the special case of string object array, which we can see is present here, then you can use double() instead of str2double()
Peng Li
2020 年 3 月 29 日
Again you have 20 rows in humidity data but 10 rows in humidity time. How do they match? If they match by rows, you can use HumidityTime(double(humidity) > 40 & double(humidity) < 50, :) to get the times that humidity meet your defined criterion.
Zeus
2020 年 3 月 29 日
回答 (1 件)
Mohammad Sami
2020 年 3 月 30 日
Humidity = str2double(Humidity(~ismissing(Humiditiy)));
lowlimit = 40;
highlimit = 50;
outsidelimit = Humidity > highlimit || Humidity < lowlimit;
alerts = [HumidityTime(outsidelimit,:) Humidity(outsidelimit)];
2 件のコメント
Zeus
2020 年 4 月 19 日
Walter Roberson
2020 年 4 月 20 日
At the time you get that output, what is the string array that you are starting with ?
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!