From: foehner on
Hi,

i have a mat file with several stations (given with station number).

I plot several parameters with a wind rose program.

I loop through the stations with

uniqstation = unique(stnr(:) );

for i=1:length(uniqstation)

I = find( stnr(:) == uniqstation(i));

sub_dd = dd(I);
sub_tl = tl(I);
sub_sdate = sdate(I,:);

where stnr is the station number, dd is the wind direction and tl the temperature, sdate = serial date

Now I want to calculate the temperature maximum and minimum of each day for the respective stations to obtain the daily temperature amplitude (later I will plot the wind direction for different temperature amplitudes, e.g. to obtain a majority of westerly winds with large temperature amplitudes)

How do I write the loop to perform this calculation?

Thanks,
Felix
From: dpb on
foehner wrote:
....

> I = find( stnr(:) == uniqstation(i));
> sub_dd = dd(I);
> sub_tl = tl(I);
> sub_sdate = sdate(I,:);
>
> where stnr is the station number, dd is the wind direction and tl the
> temperature, sdate = serial date
>
> Now I want to calculate the temperature maximum and minimum of each day
> for the respective stations to obtain the daily temperature amplitude...

> How do I write the loop to perform this calculation?
....

Do another selection (find) for each day (integer values, see fix() ) in
the serial date and min()/max() over those.

--