
Extracting a value from a text wave

puglie12
I have a text wave containing a variety of weather conditions (i.e. cloudy, mostly cloudy, clear, rainy, etc.). I want to assign values for each condition such that I can add up how many "cloudy" days there were in a certain month. So I need, for example, to write a function that looks for "cloudy" in my weather wave and creates a new wave where this value now is 1, then looks for "mostly cloudy" and assigns a value of 2, etc. This way, I can add up all of the days that had "1" and all of the days that had "2" and figure out how many days were cloudy, mostly cloudy, etc.
I am having trouble extracting these values from a text wave. Can you please help?
Thank you,
Stephanie
To understand it I recommend reading from the bottom (high level function) to the top (low level function).
The CountCondition1 and CountCondition2 functions are two ways to do the same thing. For small wave sizes it does not matter which you use. For large wave sizes I suspect CountCondition1 would be faster but I would have to test to be sure.
July 4, 2013 at 11:30 am - Permalink
July 4, 2013 at 01:43 pm - Permalink