From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-14-2020 08:29 PM
I am trying to plot X and Y values in real time, and would like a combination of what a waveform chart and an express xy graph provide. They both lack in the labels of one axis. The waveform chart doesn't show constant intervals in the x axis and neither does the y axis on the express xy graph. Is there a way to have constant intervals in both axis while plotting the points in real time?
I am updating the graph within a loop using arrays I add an element to each array during each loop. This is how:
To plot the arrays in the XY graph, I started with this code:
Which gave me this result:
So you can see they are being plotted, but the X axis is not updating for some reason.
Next I tried this (which gave me the same result):
Lastly, I tried:
Which gave me this result:
Thanks in advance for the help.
11-14-2020 08:52 PM
If the x-values are equally spaced, a plain chart or graph is file. No need for an xy graph. (you can customize axis labels, styles, and also offset/increment to show correct values on the x-scale.
Your abundance of local variables and stacked sequences show us that you are probably getting into really bad habits. None of those should be needed in a typical program. Have you done the basic tutorials?
Please attach your VIs, we cannot debug images.
11-15-2020 07:39 PM
Hi, thank you for the advice, I will try to implement it.
The reason I can only show images is because the company requires that I keep the code confidential, although of course small arbitrary snippets like these are fine.
Also, what would you recommend for basic tutorials? I got an internship and got thrown into labview without any prior exposure to labview, or any kind of programming similar to it. I watched a couple youtube tutorials to understand how it works and that was it.
11-16-2020 03:31 AM
Hi cathborisova,
@cathborisova wrote:
Also, what would you recommend for basic tutorials?
Did you notice those "Training resources" in the header of the LabVIEW board?
@cathborisova wrote:
The reason I can only show images is because the company requires that I keep the code confidential, although of course small arbitrary snippets like these are fine.
You don't need to attach your "confidential" VIs. But you could create small example VIs to demonstrate your problem - without any "confidential" stuff…
11-16-2020 01:18 PM
@cathborisova wrote:
Obviously, you are coming from a text programming background and thought "local variables" are "variables" and should be used as such. Basically, you are using front panel objects for data storage, which is very inefficient (extra data copies in memory!) and can often cause race conditions. Since LabVIEW is highly parallel, it is often impossible to tell what modified a value last. Simplified, in LabVIEW the wire is typically the variable and the resulting data dependency exactly defines execution order. There are plenty of related discussions (example).
If you want to retain and modify data between iterations, typically a shift register is the correct tool. While you are at it, also learn about datatypes. For example your "Count" should probably be an integer. Appending a scalar to an array is typically done using "build array", if that is what you are trying to do, no index input needed.
Also, if you have xy data, a 1D complex array is often a good choice. It automatically keeps pairs matched and xy graph will directly plot IM vs. RE, no need for clusters and x and y arrays.
As you can probably tell now, you are approaching this way too convoluted. Elegantly rewritten, the same functionality probably uses less than 30% of your current code.
Once you attach a simplified and sanitized version of your VI, We can give more specific advice. You are at a stage where it is important to avoid bad coding habits that cannot scale to more complicated code later.