05-03-2017 04:02 AM
Hello,
I want to develop a program in which I use the random number generator function to generate 5 random numbers, store them in an array and then output their median. This whole process has to be looped till the user stops. The array after every loop iteration has to be cleared and only the 5 random numbers are to be present in it at any given instance.
I am not able to figure out how to flush the array after every loop.
Any help will be appreciated. PFA VI.
Solved! Go to Solution.
05-03-2017 04:26 AM - edited 05-03-2017 04:27 AM
I couldn't have your LabVIEW version and hence couldn't see your code. But do you need something like in the attachment?
Mathan
05-03-2017 04:29 AM - edited 05-03-2017 04:32 AM
this generates 5 random numbers per loop iteration,
the array is newly created in every iteration.
you could initialize a 5 element array before the for-loop, and then replace the i-th element with the new random number.
05-03-2017 04:30 AM
Does the array always have 5 elements inside it after every loop iteration ?
Also how did you get that [DBL] between the build array and Median.vi ? Is it right click - create indicator
05-03-2017 04:33 AM - edited 05-03-2017 04:37 AM
@ksharshit wrote:
Also how did you get that [DBL] between the build array and Median.vi ? Is it right click - create indicator
there is a option for block diagrams, to display control/indicators as icons, which mathan and i have disabled.
(try a right-mouse on one of your indicators on the block-diagram --> view as icon)
<edit>
also note, that mathan's vi generates only one distinct random number per iteration,
but builds a 5-element array from that
</edit>