01-29-2017 10:27 AM
Hi, I'm generating XY values from (up,down, right,left) booleans (which have predefined values) and plotting them into XY Graph where I want to draw something like squares etc and I want to define the starting point in the graph itself. I have created an event structure that is triggered when the booleans are pressed, but this results in peaks and troughs only and it plots it with TIME ! which I don't want. I know this is not that hard but I think I'm missing something, if any more details are needed just inform me. Any illustration or help would be appreciated .
Solved! Go to Solution.
01-29-2017 10:54 AM
Well, I certainly don't understand what you want to do! As I see it, you want to do the following:
What I don't know is what the "Do something" is supposed to be. I know that the time of key press is not important (you said so), and I also know that you want to (presumably) "put a point on a graph" each time a key is pressed, but what isn't clear is :
Of course, as I was writing this, the thought occurred to me that you might be using the Arrow Keys as instructions like "Put the next point (left, right, above, below) relative to the previous point". But I'm not sure, and this also begs the question of where Point 0 goes.
Bob Schor
01-29-2017 11:59 AM
Hi Bob, sorry for my bad explanation. what I want to register CAN be the arrow keys or some booleans that I created. The motion that I want is actually relative so it starts at the place where the other one finished at and they should be connected so that they can form a sort of a path. One more thing is that I want to specify the starting point in the graph where always starting from (0,0) is not what I want. Hope thins clears it a bit more, thanks.
01-29-2017 12:48 PM - edited 01-29-2017 12:53 PM
@AHmedalnahdi wrote:
but this results in peaks and troughs only and it plots it with TIME ! which I don't want.
It Is not clear what you mean by "peaks and troughs" and "time". Instead of telling us what you don't want, you should tell us in detail what you want. Show us pictures. Attach your code.
All you need is an event structure to append data to a complex array that stores the data to be graphed and update the graph wenever the data changes. Append a new value that increments/decrements by a delta in either x or y, depending on which arrow button is pressed. Then you also need other events to e.g. add a new plot or move the pen without drawing (e.g. by inserting a NaN before appending the new target point. All this should be trivially easy to do in LabVIEW.
However, it might be even simpler to use a intensity graph. Now the 2D array of desired size is fixed (no new memory allocations needed at run time) and if you do the z ramp correctly, you can even change colors. I would try that.
Also, what is your LabVIEW version? (if you had attached your code, we would already know!)
01-29-2017 12:52 PM
Ah, much clearer.
Bob Schor
01-29-2017 01:28 PM - edited 01-29-2017 01:30 PM
Maybe something like this? It would be easy to add event cases to move the starting point and such, so this is just to get you started. You could also add a button to undo, e.g. to remove the last added point whenever it is pressed.
01-29-2017 02:09 PM
Thanks altenbach, that's exactly what I wanted. One tiny problem is that I'm trying to get the plot in another graph (Sketch XY Graph) since its referenced in my other code but the data that you are sending is 1D array and my graph requires a cluster of 2 elements (see the attached vi).Thanks
01-29-2017 02:16 PM - edited 01-29-2017 02:23 PM
XY graphs accept a variety of datatypes. Simply wire the complex array directly to your graph terminal and it will magically turn orange and adapt. Try it!
(And please: don't attach a VI with the same name as my VI. If you make changes, be respecful and give it a new name! ALso, what's with the disorganized whitespace you added in the right side of the loop and with the autoidexing output tunnel that goes nowhere?)
01-29-2017 02:21 PM
Ohh how did I miss that xD. Thanks a lot you're a life saver 😄
01-29-2017 02:21 PM - edited 01-29-2017 02:22 PM
.