LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting an XY graph to stay?

Solved!
Go to solution

Hello all,

I am very new so please bear with me, I am currently trying to get my cDAQ-9184 with the following additions (NI9215, NI 9219) to gather data from two separate instruments. My NI 9215 is reading off a signal generator and the NI 9219 is reading off of a linear potentiometer. I am able to get the xy graph to behave properly and show a signal but I want to be able to print a print plot for the X vs Y. I need the data to either show on my screen as a graph or I need to be able to store data for a set amount of time and then export it to an excel sheet. Once on the excel sheet I can create my graph from the gathered data, however I would prefer it if the plot would “appear” live on my graph. Any help would be greatly appreciated.

 

kind regards,

 

 

0 Kudos
Message 1 of 7
(2,017 Views)

Unfortunately we cannot debug pictures containing express VIs. Can you attach the actual VI instead?

(If you want the graph data in excel, you can just right-click the xy graph and "Export...Export data to excel".)

 

Also explain what you mean by "live on my graph" and how a "set amount of time" is implemented. I don't see that.

 

Since you are not interested in a time axis, why do you use waveforms?

0 Kudos
Message 2 of 7
(1,999 Views)
Solution
Accepted by topic author Beginner2020

As altenbach hinted, I think you might have more luck if you change your DAQmx Reads to return 1D array of doubles.

 

Then, consider if you want all of these points and a lot of data, or if you'd prefer to plot e.g. mean values. If you'd prefer mean values, take a look at something like Mean VI.

 

To store "history" for a Graph, you want to consider something like a Shift Register and the Build Array node (note that this will create an ever-increasingly long array and eventually run out of memory - if that is likely to be a problem you might consider something like a "Circular Buffer" (see second link below for more links)).

 

I've also seen it suggested (by altenbach, primarily) that the use of Complex numbers can be quite useful for plotting graphs. In that case, you should put your Y values in the imaginary part of the number and the X values in the real part. You can see a comparison I made some time ago here: Comparison of Graph inputsComparison with references to circular buffer options. Those use a scalar update each iteration (as you would with mean values) but you could adapt them easily to append arrays each iteration.


GCentral
Message 3 of 7
(1,970 Views)

Im having a hard time explaining what I need, so how about this, what would be the best way to plot a 1D array of a cluster of 2 elements. I need it to be printable so maybe exporting to Excel would work out best, I can just plot it there and then print the resultant graph. I appreciate the time and help.

Kind regards,

0 Kudos
Message 4 of 7
(1,918 Views)

The XY graph expects a 1D array of a cluster of 2 elements so you can just connect the array wire directly to an XY Graph.  Run the VI.  Then right-click the graph and select Export > Export Data to Excel.  This will generate an Excel file with a header row and your data in your temp folder.

 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 5 of 7
(1,911 Views)

After looking at your picture I'm more confused at what you're trying to do.  It looks like you should have an XY Graph updating 10 times per second with 100 points each update.  Are you just trying to "freeze" the graph so you can see the data or something?  Maybe if you explained what your end goal is we could help better.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 6 of 7
(1,908 Views)

@Beginner2020 wrote:

Im having a hard time explaining what I need, so how about this, what would be the best way to plot a 1D array of a cluster of 2 elements. I need it to be printable so maybe exporting to Excel would work out best, I can just plot it there and then print the resultant graph. I appreciate the time and help.

Kind regards,


Start by attaching your code.

 

How is your "built xy Graph" express VI configured (is "clear data on each call" checked or not?)? How many points are on the final output? How long does the VI run?

 

If you want to accumulate all data, built it in a 1D complex array in a shift register wired directly to the xy graph terminal (make sure you don't run out of memory!) and write some simple code to convert it to a tab delimited string that can be streamed to disk. 

0 Kudos
Message 7 of 7
(1,865 Views)