One way of doing this would be to initialise a Boolean array with 4096
elements, i.e. one for each number, then use Replace Array Element to
set/clear each one as needed, Index Array to check whether an
individual number has been used and Search 1D Array to find the first
unused number.

Another way would be to use an array of integers to hold the numbers
that have been used, use Search 1D Array to check whether a given
number exists in the array or not, and Build Array to add a new number
to the end of the array. To find the first unused number you'd
probably have to use a For loop and search the array repeatedly until
you didn't get a match, unless anyone can think of a better method.
I'm assuming that the used numbers are not necessarily in a continuous
block...

The advantage of the second way is that you aren't limited to 4096
values, in case you go above this in the future.

In either case you can use the standard read/write file functions to
load and save the array on disc in LabVIEW binary format, or you can
use these together with Spreadsheet String to Array and Array to
Spreadsheet String to save as a text file - this would be better for
compatibility as you could also read it in Excel etc.

Within your program, you might want to use a functional global VI to
hold the current array value (in an uninitialised shift register of a
while loop), and you could also incorporate the save and load
functions in this VI.

Hope that's enough to get you started...

Reply via email to