LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I put upper limit and lower limit on graph inside a while loop?

Solved!
Go to solution

Need help here. I am working on a project, I have collected data thru NI myDAQ,plotted a waveform chart, is it possible to add a upper and lower limit to the waveform chart? I have tried ways but cant seem to work. Any form of help is appreciated thank you.

0 Kudos
Message 1 of 37
(6,708 Views)

Hi Han,

 

in your thread title you ask about graphs, in the message you talk about charts: an example VI would help to clarify your questions!

 

Anyway the solution is to put two additional plots in your chart/graph - the context help will show you how to do this…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 37
(6,685 Views)

Thanks for replying, may I know where do I find the context? and also sorry for the confusion, I am trying to make a upper and lower limit for a waveform chart inside a while loop. I have taken a screenshot of it, the top is my NI myDAQ device collecting data, and I am hoping to add in uppper and lower limit to that. The bottom is an example I got online where someone added upper and lower limits. Do you think you can help me with that?

0 Kudos
Message 3 of 37
(6,671 Views)

Hi Han,

 

may I know where do I find the context?

Ctrl-H.

When you don't know how to open the context help you REALLY should take the free online courses for LabVIEW beginners!

 

The bottom is an example I got online where someone added upper and lower limits. Do you think you can help me with that?

The bottom example is exactly what you need.

Just convert your DDT to scalar…

 

Hint: never use the label "graph" for a chart. It will help you (and others) to understand your code…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 37
(6,660 Views)

@HanKiat wrote:

Need help here. I am working on a project, I have collected data thru NI myDAQ,plotted a waveform chart, is it possible to add a upper and lower limit to the waveform chart? I have tried ways but cant seem to work. Any form of help is appreciated thank you.


What, exactly, do you mean by "an upper and lower limit"?  Assume your chart consists of the numbers 0, 1, ... 10, 9, ... ,1, 0, i.e. a Triangle Wave.  Suppose your Upper Limit is 9, your lower limit is 1.  Do you want your chart to:

  • plot a triangle wave from 0 to 10 to 1, plus a "lower limit line" at 1 and an "upper limit line" at 9?
  • plot a "truncated" triangle wave from 1 to 9, a space, then from 9 down to 1, with chart limits at 1 and 9 and "missing points" at 0, 10, and 0?
  • something else?

Needless to say, the first two have distinct (and different) solutions, and the third probably does, as well.

 

Bob Schor

0 Kudos
Message 5 of 37
(6,625 Views)
Try Block Diagram MATHEMATICS>FITTING>ADVANCED CURVE FITTING Maybe you want Linear Fit Intervals. You can choose between Confidence Intervals or Prediction Intervals
0 Kudos
Message 6 of 37
(6,605 Views)

Hey thanks for the advice, it kind of works. but when I change it to a while loop and run it, I cant seem to plot anything out at all. Here's a picture of it, can you explain to me why?

0 Kudos
Message 7 of 37
(6,575 Views)
That is the way you programmed it. The graph is outside of the loop so nothing gets displayed until the loop is stopped.
0 Kudos
Message 8 of 37
(6,539 Views)

As you placed the waveform graph outside the loop, the results of the plot will only be displayed on the graph once the loop is stopped (e.g. the STOP button is pressed). 

 

If you know how many samples you want to output to the graph, try using a For loop instead of a While loop. 

D.S Yiauw
National Instruments | ELP Engineer
CLAD
0 Kudos
Message 9 of 37
(6,527 Views)
How will a for loop fix anything if the data needs to be displayed as it is acquired?

Place a chart inside a loop to display current and previous data. Be aware of the history length which will determine how much will be retained. A graph could be used but you would need to keep appending data in an array at the risk of memory growing unbounded and consequent slow down. What do you actually want to do?
0 Kudos
Message 10 of 37
(6,509 Views)