03-20-2006 01:37 PM
03-20-2006 02:47 PM
The only way that I though to do this was by using a for loop and inserting the values into the array one by one...
Is there a simpler way to do this?
Thanks!
03-20-2006 03:04 PM
You have to use a loop, however, you can still simplify your code quite a bit.
Use autoindexing! (This will eliminate the array size node and the index node inside the loop). 🙂
See attached, LabVIEW 7.1.
03-20-2006 03:16 PM - edited 03-20-2006 03:16 PM
When I first saw this question I thought you had to use a loop too, but my boss and I talked about it for a minute and he came up with a way to do it without a loop, but instead with two Replace Array Subset functions. Check it out:
I've also attached the VI, saved in 8.0 format.
-D
Message Edited by Darren on 03-20-200603:16 PM
03-20-2006 03:19 PM
03-20-2006 03:45 PM
Darren,
Cute! I was always a sucker for "loop free" algorithms! 🙂
In this case, the loop version is probably a bit more efficient and the code size is actually ~20% smaller (2K vs 2.4K).
For a 10x10 array it does not really matter. For huge arrays, only a benchmark will tell. 😉