From: Roberto on
Hi,

I have a variable (110x3 double) which contains these columns:
Column 1: contains a 0, 1, 2 or 3.
Column 2: contains position info like 32.01 or 1618.41 etc. (in meters). These values are first sorted by column 1 and after that in an increasing order.
Column 3: contains speeds like 32.30 or 29.71 etc. (not sorted) (in m/s).

Right, what do I want... First I need to check if there is a speed (values in the third column) less than or equal to 16.66. If so then I want to know whether there is another speed <=16.66 within 200 meters (100 in front and 100 meters behind). Therefore I have the information in the 2nd column about the positions... If this is also true then I need to go 500 meters back (starting at the position of the one with the lowest position-value) and find the first value in column 2 from that point.
If there aren't 2 vehicles within 200 meter range with speeds less or equal to 16.66, then the if-then could stop.

I think it's a little complicated so I'll give an example:

On position 1390.20 there is a vehicle with a speed of 14.9 m/s. A vehicle 85 meters in front of this (position 1475.20) has a speed of 13.4 m/s. Therefore I need to know the first value from 1390.20 - 500 = 890.20. There is a vehicle on position 913.82 and the answer I need at the end would be "913.82".

Could someone fix this for me?? I would be very thankfull!
From: us on
"Roberto " <ivogrunn(a)hotmail.com> wrote in message <i0sicb$a92$1(a)fred.mathworks.com>...
> Hi,
>
> I have a variable (110x3 double) which contains these columns:
> Column 1: contains a 0, 1, 2 or 3.
> Column 2: contains position info like 32.01 or 1618.41 etc. (in meters). These values are first sorted by column 1 and after that in an increasing order.
> Column 3: contains speeds like 32.30 or 29.71 etc. (not sorted) (in m/s).
>
> Right, what do I want... First I need to check if there is a speed (values in the third column) less than or equal to 16.66. If so then I want to know whether there is another speed <=16.66 within 200 meters (100 in front and 100 meters behind). Therefore I have the information in the 2nd column about the positions... If this is also true then I need to go 500 meters back (starting at the position of the one with the lowest position-value) and find the first value in column 2 from that point.
> If there aren't 2 vehicles within 200 meter range with speeds less or equal to 16.66, then the if-then could stop.
>
> I think it's a little complicated so I'll give an example:
>
> On position 1390.20 there is a vehicle with a speed of 14.9 m/s. A vehicle 85 meters in front of this (position 1475.20) has a speed of 13.4 m/s. Therefore I need to know the first value from 1390.20 - 500 = 890.20. There is a vehicle on position 913.82 and the answer I need at the end would be "913.82".
>
> Could someone fix this for me?? I would be very thankfull!

produce a small, exemplary data set...
show some ML code that you've come up with so far...

us
From: Roberto on
"us " <us(a)neurol.unizh.ch> wrote in message <i0t3e6$67$1(a)fred.mathworks.com>...
> "Roberto " <ivogrunn(a)hotmail.com> wrote in message <i0sicb$a92$1(a)fred.mathworks.com>...
> > Hi,
> >
> > I have a variable (110x3 double) which contains these columns:
> > Column 1: contains a 0, 1, 2 or 3.
> > Column 2: contains position info like 32.01 or 1618.41 etc. (in meters). These values are first sorted by column 1 and after that in an increasing order.
> > Column 3: contains speeds like 32.30 or 29.71 etc. (not sorted) (in m/s).
> >
> > Right, what do I want... First I need to check if there is a speed (values in the third column) less than or equal to 16.66. If so then I want to know whether there is another speed <=16.66 within 200 meters (100 in front and 100 meters behind). Therefore I have the information in the 2nd column about the positions... If this is also true then I need to go 500 meters back (starting at the position of the one with the lowest position-value) and find the first value in column 2 from that point.
> > If there aren't 2 vehicles within 200 meter range with speeds less or equal to 16.66, then the if-then could stop.
> >
> > I think it's a little complicated so I'll give an example:
> >
> > On position 1390.20 there is a vehicle with a speed of 14.9 m/s. A vehicle 85 meters in front of this (position 1475.20) has a speed of 13.4 m/s. Therefore I need to know the first value from 1390.20 - 500 = 890.20. There is a vehicle on position 913.82 and the answer I need at the end would be "913.82".
> >
> > Could someone fix this for me?? I would be very thankfull!
>
> produce a small, exemplary data set...
> show some ML code that you've come up with so far...
>
> us

Ok, I dropped two files (an m-code and an example) right here:
http://uploading.com/files/d6487286/if-then%2Bstatement.rar/

The example (01081.lst) could be read in excel. But I imported it directly into matlab. The first part of the m-code contains information to import and read the 01081.lst.
!!There is only a little change with the information I gave in my first post: the 01081.lst consists of 10 columns and not 3 (the 7 others are for this moment not really important). So:
Lane = column 3 (0, 1, 2 or 3)
Position = column 6 (like 32.01 or 1618.41 etc.)
Speed = column 7 (like 32.30 or 29.71 etc).

The second part is the if-then statement. Actually, I've no idea how to start, but hopefully someone could help me or give me some tips!

Kind regards!

If it is not clear: I'll try to explain it further ;)
 | 
Pages: 1
Prev: error with movie2avi
Next: find function