05-09-2012 03:27 PM
I'm Unable to plot a 1-D array with a cluster of 2 elements on an XY graph. The data appears at the input to the graph but nothing is plotted. I'm trying to plot a line connecting each point generated.
Solved! Go to Solution.
05-09-2012 03:47 PM
You need a shift register on the inner For Loop as well.
But beyond that, you are creating too complicated of a structure. You are creating multiple 1 point plots rather than a single multipoint plot.
See attached for the modification that works.
05-09-2012 03:52 PM
0. Do not post VIs with infinite loops! Change the True constant to a control. One of the regular participants on these Forums has commented that using the Abort button to stop a VI is like using a tree to stop a car. It works, but may have undesired consequences!
1. Use a shift register on the For loop also.
2. Inserting into an empty array leaves you with an empty array. Initialize the array outside the loop to a size greater or equal to the maximum size you will be using. Then use Replace Array Subest inside the loop.
3. Just make an array of the cluster of points. No need for the extra cluster.
05-09-2012 05:04 PM
When checking your code I found some problems:
Well what is really the issue? Do you want to a multi plot (which you are trying to do) XY-graph or just one single plot (with multiple values)?
05-10-2012 10:18 AM
If I did want to keep my original structure, that is a 1-D array of clusters with two elements and plot multipoints to one plot would that be possible? I tried to do it and wasn't able to.
05-10-2012 11:12 AM
The output of your VI is a 1D array of clusters with two elements. Is there an easy way to save that data to a file? I'm guessing I have to remove the cluster from the array, then remove the data and put it into another array and then save it to a file as usual.
05-10-2012 12:50 PM
There are several different ways of sending data to an XY graph. Open up the example finder and look for "XY Graph". That shows 4 different datatypes for sending the data between arrays and clusters. Which way is best depends on whether you want a single plot or multiple plots.
As for sending the data to a file, you probably will need to unbundle data, combine arrays, convert to strings (assuming you are looking for a text file), before writing the data to a file. Exactly what way to do that depends on your datatype for the graph and how you want the data to look in the file.
05-10-2012 12:56 PM
05-10-2012 01:07 PM - edited 05-10-2012 01:08 PM
I'm not sure what you are attempting.
You are building and array of clusters, fine, but then just indexing out that last element and breaking apart the cluster and building a 1-D array of the 2 element in the cluster.
If you want to get a 2-D array of your data, then just do this.
05-10-2012 01:09 PM