LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY-Graph :: Very specific problem

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

0 Kudos
Message 1 of 8
(3,406 Views)

The output of N is the number of iterations, that is 360. You should wire the iterator index i +1 instead.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 8
(3,395 Views)

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... Smiley Sad

 

Rajat

0 Kudos
Message 3 of 8
(3,378 Views)

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:

string to graph.PNG

There will be many other ways to do this (some of which may be more efficient/elegant). This is just an example.

0 Kudos
Message 4 of 8
(3,356 Views)

The graph you uploaded is what I would expect from the old code. Can you attach a picture of the new code?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 5 of 8
(3,344 Views)

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.

0 Kudos
Message 6 of 8
(3,294 Views)

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 Smiley Happy

Satish

snippet 2.JPG

0 Kudos
Message 7 of 8
(3,211 Views)

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.

 

Download All
Message 8 of 8
(3,203 Views)