03-25-2006 09:54 PM
03-26-2006 01:35 AM
In general, it's better to use a for loop when building arrays because the while loop requires dynamic memory allocation. However, if you know that your array will always be of that size, you can initialize it before entering the loop and use shift registers coupled with Replace Array Subset in a case structure to replace the elements you want.
It's unclear where your problem is, but if it is in finding out that 64 iterations have passed, you can do that by something as simple as having a running counter (with a shift register) which will increment by one with each iteration. Another option is to add 1 to the iteration counter and feed the result (together with 64) into the Quotient & Remainder function. Whenever the remainder is 0 you're on a multiple of 64 (the one is added to avoid getting 0 on the first iteration). If this doesn't help you, explain exactly what your problem is.
03-26-2006 07:48 AM
03-26-2006 11:35 AM
If you want to generate a regular 3D lattice, you could do something like in the attached example. Of course you need ot change the indexing order according to your requirements.
03-28-2006 05:26 PM
03-29-2006 11:16 AM - edited 03-29-2006 11:16 AM
What are you actually trying to do? Please just describe how you want to fill the elements of the 2D array and one of us will show you how with a few mouse strokes.
Your VI is way too confusing and overly complex. You are overwriting each column 64 times in a row before proceeding to the next column. This is a lot of unecessary work! Why?!
Message Edited by altenbach on 03-29-2006 09:16 AM
03-29-2006 02:12 PM
I want the X value of the array to fill in counting up from 0 to 30 and then back down to 0 where a value gets filled in to the X part of the array every 64th cycle of the loop.
Then I want the Y value of the array to count up from 0 to 29 and then start over at 0 again and count again. I want the Y value to increment every time the X value reaches 0 or 30 (except the first 0).
Then I want the Z value of the array to count up from 0 to 79. I want it to increment every time the Y value is 0 (except the very first).
Does this make sence? That is what I was trying to do in my code.
03-29-2006 05:54 PM
@musser wrote:
Then I want the Z value of the array to count up from 0 to 79. I want it to increment every time the Y value is 0 (except the very first).
Well, this is not entirely clear...
Attached is a simple example that more or less implements my interpretation (point 2 above) of your requirements (LabVIEW 8.0). To save memory, I do everything as I32 (You could even do it as U8!). Maybe you can modify it for your needs. 🙂
For easy inspection of the resulting array, I display it also on a graph.
03-30-2006 12:21 PM
I ment 39, 79 was a typo. Thanks for the help, this is perfect