03-01-2011 04:19 AM
I'm trying to draw a XY-graph of 360 angle readings. I'm getting an input from a device which is of the form:
1,898,
2,455,
......
360,122,
Here the first number is the angle and the second number is the reading for that angle.
I want to display this information on a graph and for that after reading the data from the device, I use a sub-module as shown in the attached picture to distinguish the two numbers and store them into an array (which I initialize outside the whole loop). The problem is that I'm not getting the desired graph, as the output.
I'm not getting any output, actually.
Please help, I'm an amatuer at LabVIEW.
Thanks in advance.
Cheers
Rajat
03-01-2011 04:46 AM
The output of N is the number of iterations, that is 360. You should wire the iterator index i +1 instead.
03-01-2011 07:09 AM
Still nothing.... I'm not getting any output. Also the output graph only shows values from 320 to 360 (please see attached picture).
I fear I might be using the wrong subVI's in the form of "Build XY Graph" and "XY Graph", in the previous picture.
Please help...
Rajat
03-01-2011 07:28 AM
You might be better off avoiding the for loop, the way it is wired up at the moment doesn't look too promising! Try working through what you think the for loop is doing on each step and look at whether it is really outputting what you require.
An alternative option is to use the 'spreadsheet string to array' function and then index the array to create your x and y data:
There will be many other ways to do this (some of which may be more efficient/elegant). This is just an example.
03-01-2011 07:40 AM
The graph you uploaded is what I would expect from the old code. Can you attach a picture of the new code?
03-02-2011 07:44 AM
Given your original question, do you want a graph with angle on the X-axis and reading on the Y, or do you want a polar plot? If the latter, create the inputs as _Ian_ suggested and use them in the 2D Compass plot instead of the XY plot. Alternately, you can convert from polar to rectangular coordinates using the Polar to Re/Im primitive, then use the XY plot.
03-25-2011 12:17 AM
Hi Rajat,
Based on the string you have mentioned, there is a new line for every set of data. I dont see you doing that in the code you have attached. You will have to eliminate that too. I have attached the code to split up the string. Once done, it is just using the Build graph vi. I ope this helps
Kudos are welcome
Satish
03-25-2011 01:13 AM - edited 03-25-2011 01:18 AM
Stop the insanity!!! 😄
If the input string is a 1D sequence of numbers seperated by commas, use "spreadsheet string to array" with comma as delimiter and a 1D numeric array as type. Now decimate it into two arrays, giving you the angle and magntude.
Scale the angle to radians and form the complex array and wire directly to the xy graph. See if this works for you.
(If you data has linefeeds to seperate the pairs, modify as needed. It would help if you could attach an actual VI containing typical string data as a diagram constant.)
(btw: There is no reason for your sequence structure in your code. Why is ist cluttering up your diagram?)
Here's a simple example (LV 8.2) that generates an array of data, then plots it. The framed part is all the code you need for your data.