LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can anybody help me in determining the most current max and min for this case?

 I have to use a for loop to generate random numbers, and then i have to determine the running the max and min.
I have made one VI which is attached with this message. Can anybody please suggest me something better, or let me know how good is that. I am learning so any suggestions are appreciated.
Thanks,
0 Kudos
Message 1 of 9
(3,331 Views)

The right part of your code doesn't do anything. It checks to see if the Max is bigger than the Min (always yes, unless it happened to be equal, in which case it won't matter) and then takes the max. Instead, wire the max output directly into the SR.

You can duplicate this code, using another SR, to get the minimum value.

If you don't need to have the values inside the loop, you can get rid of the SR and wire the random # directly out of the loop, which will build the numbers into a 1D array. Then, look inside the array palette to find the min and max.

To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).

___________________
Try to take over the world!
0 Kudos
Message 2 of 9
(3,328 Views)
Thanks for the suggestions. But what you have suggested about the array thing.... If i use the array, i'll get the max & min from the array, whereas what i need is the 'the most current running max and min"
 
 
0 Kudos
Message 3 of 9
(3,317 Views)
Then do what I suggested in the first 2 paragraphs - leave just the array min & max and duplicate the code with another shift register for the min value.

___________________
Try to take over the world!
0 Kudos
Message 4 of 9
(3,312 Views)

I have attched this VI, what about this one. please let me know.

 

Thanks

0 Kudos
Message 5 of 9
(3,309 Views)

That's not it either. What I suggested was two SRs - one to hold the minimum value and one to hold the max. Then, you wire the random # into 2 Min\Max VIs (not the array min\max) and take the minimum from one and the maximum from the other.

Note that you will need to init the min SR to a high number. You should also change its representation to DBL to avoid coercions inside the loop. Other tips would be to set LV to place terminals not as icons and to replace the express VI with a wait VI which will have 1000 wired into it.


___________________
Try to take over the world!
0 Kudos
Message 6 of 9
(3,301 Views)
Thanks for the suggestions. Since, i am new to all this, i don't have a great understnading in all this. i haven't got it yet, but will get it.
0 Kudos
Message 7 of 9
(3,283 Views)

I guess you may use:

Analyze\Point By Point\Probability and Statistics Point By Point\Array Max&Min PtByPt.vi

 

You can wire the random number directly to the input, and define how 'current' the peaks are by defining the sample length.  Remember to initialize this vi when the loop count is zero.

 

Hope it works.

0 Kudos
Message 8 of 9
(3,223 Views)
Thanks...
0 Kudos
Message 9 of 9
(3,212 Views)