From: Aaron Anstey on
I have an array of data that contains a vehicle's speed for a journey that lasts 600 seconds. I have an individual record of speed for each second of the journey. I would like to count the occurrence of each individual speed (kph) from 0 to 78 kilometers per hour in order to understand which speeds occur the most. For example the speed of 50kph may occur 20 times throughout the journey...
Can anyone suggest what commands I need to use? Many thanks for your help, Aaron
From: utab on
On Sat, 24 Jul 2010 18:44:04 +0000, Aaron Anstey wrote:

> I have an array of data that contains a vehicle's speed for a journey
> that lasts 600 seconds. I have an individual record of speed for each
> second of the journey. I would like to count the occurrence of each
> individual speed (kph) from 0 to 78 kilometers per hour in order to
> understand which speeds occur the most. For example the speed of 50kph
> may occur 20 times throughout the journey... Can anyone suggest what
> commands I need to use? Many thanks for your help, Aaron

Hi, the first thing that comes to mind is find. see the short array

arr = [4 5 5 2 5 6 9 8 7 9];

for instance find 9 in this array

length((find(arr == 9))

output 2

HTH.
U.
From: someone on
"Aaron Anstey" <elaja2(a)lboro.ac.uk> wrote in message <i2fc9j$ha6$1(a)fred.mathworks.com>...
> I have an array of data that contains a vehicle's speed for a journey that lasts 600 seconds. I have an individual record of speed for each second of the journey. I would like to count the occurrence of each individual speed (kph) from 0 to 78 kilometers per hour in order to understand which speeds occur the most. For example the speed of 50kph may occur 20 times throughout the journey...
> Can anyone suggest what commands I need to use? Many thanks for your help, Aaron

doc hist

% And look at the

[n,xout] = hist(...)

% option.
From: Aaron Anstey on
"someone" <someone(a)somewhere.net> wrote in message <i2fekj$d2k$1(a)fred.mathworks.com>...
> "Aaron Anstey" <elaja2(a)lboro.ac.uk> wrote in message <i2fc9j$ha6$1(a)fred.mathworks.com>...
> > I have an array of data that contains a vehicle's speed for a journey that lasts 600 seconds. I have an individual record of speed for each second of the journey. I would like to count the occurrence of each individual speed (kph) from 0 to 78 kilometers per hour in order to understand which speeds occur the most. For example the speed of 50kph may occur 20 times throughout the journey...
> > Can anyone suggest what commands I need to use? Many thanks for your help, Aaron
>
> doc hist
>
> % And look at the
>
> [n,xout] = hist(...)
>
> % option.

The "hist" command works really well. Thanks.
From: us on
"Aaron Anstey" <elaja2(a)lboro.ac.uk> wrote in message <i2fipn$t2s$1(a)fred.mathworks.com>...
> "someone" <someone(a)somewhere.net> wrote in message <i2fekj$d2k$1(a)fred.mathworks.com>...
> > "Aaron Anstey" <elaja2(a)lboro.ac.uk> wrote in message <i2fc9j$ha6$1(a)fred.mathworks.com>...
> > > I have an array of data that contains a vehicle's speed for a journey that lasts 600 seconds. I have an individual record of speed for each second of the journey. I would like to count the occurrence of each individual speed (kph) from 0 to 78 kilometers per hour in order to understand which speeds occur the most. For example the speed of 50kph may occur 20 times throughout the journey...
> > > Can anyone suggest what commands I need to use? Many thanks for your help, Aaron
> >
> > doc hist
> >
> > % And look at the
> >
> > [n,xout] = hist(...)
> >
> > % option.
>
> The "hist" command works really well. Thanks.

-and- don't forget the faster

help histc;

us