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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional Graph

Solved!
Go to solution

Hello, 

I have been working on a LabVIEW exercise and am having trouble making the program work. The program is suppose to allow user input to manipulate the graph shown on the front panel. I am not entirely sure where my error is but I believe it is my lack of input. I'm still relatively new to using this program so any help would be greatly appreciated.

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

Your inner FOR loop iterates zero times and only produces an empty array as output.

0 Kudos
Message 2 of 7
(2,228 Views)

Thanks for the quick response. I see what you are talking about.  I've been stuck the last couple days on this part and I know the solution should be obvious but i'm not quite seeing it. Would I connect the FOR loop iterations to the Loop Count?

0 Kudos
Message 3 of 7
(2,217 Views)

@Kimberly881 wrote:

Would I connect the FOR loop iterations to the Loop Count?


No, I would not! The loop count, and thus the size of the array will grow without bounds and you'll run out of memory eventually.

 

I assume you want a fixed x-range (e.g. 0...2pi) and with a fixed number of points, so you can di that once before the loop. The rest could e.g. look as follows. (not sure why you need the property nodes)

 

ex.png

0 Kudos
Message 4 of 7
(2,190 Views)

Thank you for all the help!

So the property nodes allow the user to pick the x axis boundaries and the number of segments the graph will have. Do the property nodes need to be connected as an input? I attached my exercise again with the FOR loop iterations fixed as you suggested.

0 Kudos
Message 5 of 7
(2,181 Views)

@Kimberly881 wrote:

So the property nodes allow the user to pick the x axis boundaries and the number of segments the graph will have.


No, I have no idea what you mean by "number of segments", but the "AutoscaleDelay" property is certainly not correct for that. Did you even read the help?

 

You really need to do a few basic LabVIEW tutorials first.

  • your two property nodes can be combined into one and they should only get written when their inputs change, not with every iteration of the loop.
  • You FOR loop is completely pointless and will return a single scalar constant. Do you know the difference between scalar and array?
  • Your xy graph only display a single point and since you have it show lines, you need at least two points to see anything at all.
  • You can also change the xmin and xmax directly on the axis. Since your x-axis is set to autoscale, the properties are constantly fighting. Don't set the min and max if the axis is set to autoscale, right?
  • Switches don't make a good UI. Use a checkbox or button or similar.
  • In the original code, the x-values are scaled equally, so all you need is a waveform graph with correct x0 and dx. No need to xy graphs. In fact, since you now are only generating one point per iteration, you could even use a chart.
0 Kudos
Message 6 of 7
(2,175 Views)
Solution
Accepted by topic author Kimberly881

Thanks for all the help and advice. I have a better idea of how to fix the program now.

0 Kudos
Message 7 of 7
(2,169 Views)