07-24-2019 04:55 AM
I have a numeric data array of elements having data as {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
which increment index by 1 every time.
In the second loop i want the data in array as {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0}
in the third loop i want the data in array as {2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1}
in the fourth loop i want the data in array as {3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2}
in the same way this should happen till the last loop no 15th
Please help to solve this problem.
08-01-2019 04:45 AM
Hello, sukanya.sa,
I have attached .zip files where you can find solution fo your issue.
As I don't know what LV you are using I have made the second one for old LV version.
In the block diagram, you can find an explanation of the program.
Please feel free to ask if you still have questions.
08-01-2019 05:19 PM
use rotate 1D array in a loop.
This example creates your input array on the left, then generates 16 different 1D arrays, one for each iteration of the second loop as required (red arrow shows where the current array is available). The output shows one row per iteration, verifying your requirements.
08-05-2019 03:53 AM
Optionally combine the Rotate 1D Array with a shift register:
If the array is really large (kB), and you only want a small subset, something like this might work:
This could use some safeguarding, for instance a check for length > array size, index> array size-1, and so on.
This might not even be faster. The rotate could translate to a subarray wrapper (making the rotate almost 'virtual'), instead of an actual movement of memory. Benchmarking would be needed... Use the simple solution until it proves to be too slow.