12-03-2013 03:37 PM
I know what I am trying to construct, but I just cant quite imagine what the script will look like
I want the user to be able to enter a set of coordinates and each time they are entered they are instantly plot onto an xy graph.
Then two new numeric controls are accessable to enter another pair of cordinates. This will keep looping until the final coordinates
match the initial coordinates.
Plotting the points isnt the problem, its just this data entry problem.
Any advice greatly appriciated! Thanks
12-03-2013 09:07 PM - edited 12-03-2013 09:14 PM
Hi Woody2230,
From what I understand from your statements it should be something as below?:
Hope it helps
Warmest regards,
Lennard.C
12-05-2013 12:48 PM
Hi Lennard,
Thank you so much for your help! Thats a great solution
I now want to employ a previous program I wrote into this one. The previous program relied on only three coordinates and then
when the program was run a small marker would smoothly move between the points
I want to now try and make a marker smoothly run between the users many inputted points
I have attached the vi's of both programs to make my explanation clearer
12-05-2013 07:27 PM
Hi Woody2230,
You're welcome. I'm currently looking at the 3 coordinates.vi. May I ask if you can explain how the code (3 coordinates.vi) works? Which part of the function do you want to inplement the plot points.vi into the 3 coordinates.vi? What does the change direction supposed to do in the code (3 coordinates.vi) operation?
Thanks
Warmest regards,
Lennard.C
12-05-2013 07:45 PM
Hi Lennard,
The change direction alters the case structure, in which there is the same stacked sequence however it is stacked in the reverse order.
I have almost managed to create a full solution to my problem. I have used a stacked structure to allow the user to first set all the coordinates and then in the next frame the function draws them. Everything should works, however I have my source and sink in the wrong format and am unsure how to solve.
Please take a look and let me know. No doubt the solution is glaringly obvious
Many Thanks
12-05-2013 08:32 PM - edited 12-05-2013 08:35 PM
Hi Woody2230,
Does the change direction function is to be used during the vi's execution (ie. you can change direction when the vi is still running)? May I ask what LabVIEW version you're running on? And what are X1, X2 and X3. Which is the latest coordinate and the initial?
Warmest regards,
Lennard.C
12-05-2013 08:34 PM
Woody,
You do not need local variables or sequence structures and you should learn to program in LabVIEW without them. While there are places where they need to be used, those places are rare and very specific.
Next, indexing the points cluster with the last value of i is not what you want. Put an indicator on that wire and see how many iterations that loop has run while you are entering a few points! What you should do is to add another shift register with an integer (I32) datatype. Inside the True case (where new coordinate is appended to the array) you increment the integer value. When you exit the loop, the value will be one greater than the index of the last element in the array. Arrays in LabVIEW use zero based indexing. When you index an element that does not exist from an array you get the default value for the element datatype, (0,0) in this case.
You may also want to do the search for initial point inside the True case. If the user accidentally enters the initial value while the Final Coordiante? button is pressed, the loop will terminate.
Initializing the shift registers may be a good idea as well unless you want the values saved from one call to the next.
Lynn
12-06-2013 12:37 AM
Hi Woody,
I have tried to integrate the plot points.vi and the 3 coordinates.vi. The result is the attached vi (I saved it as LabVIEW 2012). I believe the screenshots below of the code could explain how it works.
Hope it helps
Warmest regards,
Lennard.C
12-06-2013 07:38 AM
This solution needs a 50ms delay in the loop to prevent it from using all the processor time and starving the UI thread, making data entry difficult. A much better solution would be to use an event structure for entering your data. Check the LabVIEW examples for details.