let me try to explain what I want to do, with Wolfram Mathematica, with an example. I have subdivided a 1.7 meter long rod in several segments with offsets
{0., 0.533, 0.617, 0.819, 1.131, 1.455, 1.511, 1.7}
Let me give a position, e.g. x=0.56, I want to know in which segment that x is located. In this case x belong to segment=2.
If I give x=1.15 I should get segment=5.
If I give x=1.61 I should get segment=7.
And so on.
Obviously avoiding loops.
Many thanks for the help
Found! Thanks anyway!
Fist of all I get a table containing only zeros:
then I compare
x := 1.61; x - Offs
so I get an array containing positive numbers if x > Offs[nth element]
The
allows to compare element by element the two arrays:
Finally I count the "True" elements.