Effacer les filtres
Effacer les filtres

What statement should I put?

2 vues (au cours des 30 derniers jours)
Zach Hanses
Zach Hanses le 14 Déc 2021
What statement would show the days that fit the condition below?
for i = 1:length(n-1)
if (avePrecipitation7Days<1 & aveDailyTemp>2)
plantingDates = ????
end
end
Background: I am trying to find the most suitable days to plant. avePrecipitation7Days and aveDailyTemp are both 1x244.

Réponses (1)

Walter Roberson
Walter Roberson le 14 Déc 2021
Something like this?
mask = (avePrecipitation7Days<1) & (aveDailyTemp>2);
Indicator = strings(size(mask));
Indicator(mask) = "GO";
Indicator(~mask) = "no"
Question: what are your units? millimetres of precipitation ? Degrees Celcius? Is that "average" for temperature including nighttime, or is it the daytime high?
If those are millimetres and Celcius, then where I live, you would be selecting April 7th to April 14th, and October 14th to October 21st only. Before April 7th the mean daily temperature is too low; after April 14th the 7 day average precipitation is too high. Before October 14th the 7 day average precipitation is too high; after October 21, the mean daily temperature is too low.
Early April is considered to be a minimum of one month too early to plant crops here: the ground has not thawed yet, and there too much chance of a frost. Mean daily temperature does not tell you much about frost risk: our averge high for April is 10C but our average low (considering the whole month) is -2C .

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by