Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Data comparison and storing

조회 수: 2 (최근 30일)
Zeus
Zeus 2020년 3월 28일
마감: MATLAB Answer Bot 2021년 8월 20일
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
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
Zeus 2020년 3월 29일
so i managed to get them to be equal ,I got rid of the excess <missing> terms by changing my data collection code.
I have tried ur suggestion HumidityTime(double(humidity) > 40 & double(humidity) < 50 and it is not working .Please suggest an alternative
Humidity =
46.8068
42.5006
35.1041
48.0938
45.3460
41.2533
47.9431
37.3616
36.7546
42.3771
HumidityTime =
2 24
4 48
7 12
9 36
12 0
14 24
16 48
19 12
21 36
24 0

답변 (1개)

Mohammad Sami
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
Zeus 2020년 4월 19일
it gives me this when i run .i need to have nx3 matrix in output (hours minutes Humidity)
Humidity =
NaN
outsidelimit =
logical
0
alerts =
0×2 empty double matrix
Walter Roberson
Walter Roberson 2020년 4월 20일
At the time you get that output, what is the string array that you are starting with ?

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by