LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Outputting 100 numerical readings

Still a newbie but making some small progress. Current phase of project involves taking 100 sequential measurements (peak amplitude,) outputting them to a spreadsheet or equivalent, checking each reading against min/max limits, and flagging any deviations. Is this done by incorporating an excel spreadsheet into the VI, or is there some way to do it within LabVIEW directly? Haven't worked with TABLES and ARRAYS but it doesn't look at first blush like those would do it for me. (?)

As a dummy test, I was able to make a 100 cycle FOR loop, and output data from a random number generator to a waveform chart. Looks cool, but I also need the numbers in chart form, as mentioned.

As a corollary, is there a way to keep the x-axis waveform chart scale from updating each time I run the VI? In other words, I want it to stay at 1 to 100, rather than incrementing to 100 to 199, then 200 to 299, etc, each time I run the VI.
0 Kudos
Message 1 of 15
(3,388 Views)


California wrote:
As a corollary, is there a way to keep the x-axis waveform chart scale from updating each time I run the VI? In other words, I want it to stay at 1 to 100, rather than incrementing to 100 to 199, then 200 to 299, etc, each time I run the VI.

Hi California,
change your Chart history to 100 (right click on the chart and go to the point "Chart History Length ...") . Now go to the properties and change Update Mode to "Scope". I think thats what you want.
 
Mike
0 Kudos
Message 2 of 15
(3,383 Views)
Thanks, Mike. I did experiment with the chart history length yesterday, and also switched update modes, but nothing seemed to eliminate this issue. Must be something else I'm missing.
0 Kudos
Message 3 of 15
(3,377 Views)

Hi California,

if you want that the chart every time you run the vi, starts with 0 you have to clear the history first. To do that, create a property node of the chart, select "History Data" and connect an empty array to it. Arrange it in this way, that it runs before you write new data to the chart.

Is it what you want?

Mike

 

0 Kudos
Message 4 of 15
(3,364 Views)
Sheesh. This program seems like it will be easy to use once I understand it, but the learning curve is steep. I spent the better part of the day trying to understand your suggestion, and figure out how to implement it. The book I have suggested the same thing, as does the help index. But, not knowing enough to make it work like that, I resigned myself to further reading. I did learn how to create a numeric array, which is part of the puzzle. As for the chart not clearing after each run, my reading led me to believe that a graph would be more appropriate, so I replaced the chart with a graph. Identical appearance, but the x-axis scale doesn't increment with each run of the VI.

Thanks for your help. I'm glad that one is behind me.
0 Kudos
Message 5 of 15
(3,340 Views)

All right, in the absence of any other suggestions, I found a way to put 100 test readings neatly on a one-page front panel. This is how I did it: I put five 1D numeric indicator arrays on the front panel. I used a case structure and some numeric comparison functions to monitor and sort the iteration count of the for loop on the block diagram. So iteration numbers 0 thru 19 went to the first indicator array, 20 thru 39 went to the second, etc. Then, I used the scroll bar in each of the front panel indicators to scroll to the 20 active cells in each one, and then hid the scroll bars.

I took it a step further and created a numeric constant array to assign target values for each reading. Then I added a couple of controls to allow an adjustable amount of deviation up or down from the ideal curve. I compare each test reading with the min/max limits, and another case structure sorts results into columns using the iteration count. So now, the front panel displays a graph with three plots: actual, high limit, and low limit. It also displays five columns of 20 readings, and five more adjacent columns that say OK, LOW, or HIGH, and a PASS or FAIL indicator that simply indicates whether any readings are out of spec.

0 Kudos
Message 6 of 15
(3,307 Views)

Why don't you attach your VI instead of long paragraphs of descriptions. 😉 It is much eaier to make suggestions if we can look at something.

I would use a graph instead of a chart, it is more leightweight. Use an array fixed at 100 elements. Fill it with NaN to clear the graph and replace elements with real data as it arrives, keeping track of the insert index. This ensures that everything happens "in place" in memory.

To display a long 1D array, you can reshape it to a 2D array (optinally transpose it) and display it either directly or as a table. No need for all that song and dance with multiple indicators and scroll positions.

0 Kudos
Message 7 of 15
(3,301 Views)
Here's a simulation of what I think you need. But altenback is right, a sample of your vi shows more than thousand words.
The vi uses graph instead of chart, randomly generates values from 0-.99, compare them to .25 and .75 as lower and upper limit respectively, graph them and show both peak counts.

Hope it helps you.
0 Kudos
Message 8 of 15
(3,283 Views)

Thanks for the feedback. I didn't know attachments were OK but it makes sense that they are. Unfortunately the latest revision of my VI has three subs, so I'll attach those in a follow up post. Here's the main VI. The front panel has the look I need, but it wouldn't surprise me at all if the block diagram is a convoluted mess. One trouble I've had with 2D arrays generated from nested for loops is that then chart ends up with five plots from 0 to 19 instead of one plot from 0 to 99.

 

0 Kudos
Message 9 of 15
(3,254 Views)
Here are the sub-VIs referred to above.
Download All
0 Kudos
Message 10 of 15
(3,253 Views)