11-12-2014 01:00 AM
A very good day to all. I am actually working on a system that will be selecting integer number from randomly generated set of number. If that wouldnt be possible, I would like the system to be able to select number from the set of numbers which have already been randomly generated from excel. kindly help me with the solution. To make myself clear, supposing I have set of numbers from 1 to 10, I want a labview setup that will be picking these numbers one after the other either with replacement or without from excel or self generated. I know this is possible in matlab but would prefer labview if possible. Thanks
Solved! Go to Solution.
11-12-2014 02:04 AM
All of it is possible in LabVIEW. First question, "why do you need an array of random numbers -- why not generate them at time of use?". Assuming you really do need to do it this way:
Use a FOR loop and a random number generator to create an array of random numbers. Scale and round as nessessary.
Not sure how you want to select the numbers If button press, use a FOR loop with an EVENT structure inside to react to the button press. Wire the loop index counter to an index array function to get each random number out of the array in succession and display them in an indcator.
These are the steps you'll need, if I understand your requirements. Read some tutorials and have a go at it. Show us what you come up with and where you run into problems and we can give some more pointers.
11-12-2014 02:17 AM
11-12-2014 02:41 AM
Most, if not all, of the languages I've run across have a rand() function that returns a random number between 0 and 1. Getting some other range is up to the programmer. Usual method is to multiply by the range you need and add an offset to adjust the mean. For instance if you need a random number between 200 and 300 the formula might look like " rand()*100+200 ". If you need an integer, you can use the round function (which will leave it as a float with no decimal pportion) or the conversion (to int). All of this is doable and straightforward in LabVIEW. Have a look: http://digital.ni.com/public.nsf/allkb/FCCDCD678EEF3A9186256D7B008054F5
If you feel more comfortable pulling from a file, try this: http://digital.ni.com/public.nsf/allkb/C944B961B59516208625755A005955F2