Hi. I need build a array, with the number 10 in all positions of array. For example, if array is of size 10x10, the number 10 must appear in the 100 positions of array. But I need that the number go storing in array as follows: That store the number 10 in all row 1 of left to right, in row 2 of right to left and so on. I attached my VI, but i have a problem, the program make well the sequence but the number 10 no storing in some positions, this positions is inthe extrems of some row,i think that i need to maintain the number of column for two cicles, buy i don't know very....Help me.!!...Thanks!!
Solved! Go to Solution.
You said you want your array to be 10x 10, but you initialized it to only 9 x 9.
Pay attention to where you increment your index. You are incrementing your index before you replace array subset. So on iteration 0, you wind up replacing at index 1 and completely missed index 0. Increment at the end of the loop after replacing the element, not before replacing the element.
I don't understand the comparisons to 15 and 8. That seems like odd comparisons when you would be looking at a range of 0 to 9. Something seems very awkward about comparing to those two numbers, and the use of 3 shift registers to track values when you are only incrementing two indices.
Yes you don't want to increment or decrement your index on the column in the iteration where you are also incrementing a row. So work that into your logic.
You probably want to stop your while loop when you hit stop OR you've reached the end of your replacements.
I would consider making two For Loops, one that iterates for rows, the inside one iterates for columns. Shift registers on both to maintain the array. Then use the i value of the inner loop to replace your element when you are in even rows, or the 9-i element when you are in odd rows.
Since your indices are integer values, you should be using the blue integer datatype rather than orange floating point wires.
for my application, I need store the number 10 in first row of left to right, in the second row for right to left, and so on. I am used a up-down Counter for the positions of columns, for this reason the comparation.
There are a signal for control of counter, when this is 8 or 15, the row change of value and the counter of column position change of direction.
Ah got an idea what you are trying to achieve and made a quick example. Check it
Put the array indicator inside the loop and you don't need to write to the value property node.
This is more along the lines of what I said, (though Panand's implementation was pretty close.) I cleaned up a few other things.