03-03-2008 11:11 AM
03-17-2008 12:06 PM
04-02-2008 08:55 AM
Hi GrahamG,
Thanks for your reply and interest. I haven't got a code written for this but I have a pseudo algorithm written (if you can call it that!). I was thinking a "random walk" method would work best.
If I have the actual 6 x 4 height field as shown below:
0 0 2 4 5 6
1 1 4 6 6 7
2 3 4 5 6 7
2 2 5 5 7 8
In my measurements I get the X-heights: heights along a row are correct relative to elements in that row
1 1 3 5 6 7
2 2 5 7 7 8
6 7 8 9 10 11
-1-1 2 2 4 5
and Y-heights: heights in a column are correct relative to elements in that column.
3 1 2 0 4 -1
4 2 4 2 5 0
5 4 4 1 5 0
5 3 5 1 6 1
Start with an empty array,
choose start point and enter into array.
So if I start with element row 2, col 2 in th X data: height = 8. (rows and columns numbered 0->5 and 0->3)
start point (2,2) height= 8
move to next adjacent point in vertical or horizontal direction to start point (not diagonal) choice of (1,2), (3,2), (2,1), (2,3).
choose (1,2)
as move in vertical direction check the relation in the Y-data between (2,2) and (1,2):
Y (1,2) h=4, Y (2,2) h= 4 =>dh =0
therefore height (1,2) =8+dh =8+0=8
move to next adjacent point in vertical or horizontal direction to point (1,2)
choose (1,3)
as move in horizontal direction check relation in X-data between (1,2) and (1,2)
X(1,2) h=5, X(1,3) h=7 =>dh = +2
therefore height (1,3) = 8+dh=8+2=10
repeat until all points have been adjusted (keep track with another array?)
This gives the correct relative heights for all points along columns and rows.
following the above pseudo algorithm would get
4 4 6 8 9 10
5 5 8 10 10 11
6 7 8 9 10 11
6 6 9 9 11 12
each point is 4 greater than actual but relatively correct.
Now that I have written it out like this it becomes a bit clearer for me! and will try to implement this solution. In the meantime any help gladly accepted.
04-03-2008 07:52 AM
04-09-2008 07:59 AM
Hi GrahamG,
Just completed the vi and it works for the example I gave, so posting it so that it may help others. There are one or two little snags that someone might fix quite quickly. I explain in text boxes in the block diagram what the vi's are doing, the problem I have is that depending on where I put my conditional test to see have all valid points been assessed I either get one loop too many or one loop too little, this probably a basic error!
It is an untidy vi with lots of arrays (and indicators for my own debugging which I have not removed), but it works in the main.
Comments and suggestions are more than welcome.
Three vis attached:
Main vi: random.vi
sub vi: sub_random_element_identifer2.vi
sub vi: sub_random_element_jump.vi