已解决! 转到解答。
Thank you both for the help.
I always thought an indexer of a for loop indexes columns, not rows. But in Fernando's example it seems like rows are being index, then summed.
Why, for example, is the attached not working?
array a = [1,2,3]
array b = [1,2,3,4,5]
in LV a+b = [2,4,6].
In your case you are adding [] to [n, n+1, n+2]. You cannot do this.
In this situation, you should have used the "build array" function, right clicked it, and selected "concatenate inputs."
@Fernando0901 wrote:
In your case you are adding [] to [n, n+1, n+2]. You cannot do this.
You can do this, it just wont work the way you want 😉
So to verify, the attached two blocks perform the exact same summing (of columns) operation?
Thanks
Summed would have the same result in either case- Which is quicker to sling? What if you wanted to really boost the array size and started bogging down a CPU core? Which for loop is parallelizable?
One.jpg on all counts.
Now wait for Altenbach, He'll chime in with a perfomance enhancement
Hold it..... I'm channelling.
For even better perfomance, since the size of the output array can be determined. Initiallize an array of the required size and replace index[i] inside the loop. This prevents re-allocating the array buffer multiple times as the array size grows"
Hi
I try to find the number of ones in array at the end but it is not working.
Could some one help?