12-04-2014 10:32 AM - edited 12-04-2014 10:40 AM
1st question
I want to get three elements out of an array but I do not need to modify the array. Should I just use index array function?
Since I am not modifying elements in this array I should not use in place structure? Am I correct with the thinking that I should only use in place structure when you are directly operating on elements in an array?
2nd question
Do method 1, method 2, or method 3 make a huge different? This code will be called every ~50 ms.
Solved! Go to Solution.
12-04-2014 10:42 AM
1. Just use Index Array or Array Subset.
2. There is no difference once the compiler does its optimizations. Just use method 1.
In general, the In Place Element Structure adds very little benefit in modern versions of LabVIEW. There are the few exceptions, but the compiler handles a large percentage of the "in place" actions you will perform.
12-04-2014 11:17 AM
Another option (less diagram clutter) is to simply use "array to cluster" with the cluster size configured to be four.
How big is the array?
Does the order of the array elements correspond to the cluster order?
12-04-2014 11:19 AM
@sticyfinger wrote:
2nd question
Do method 1, method 2, or method 3 make a huge different? This code will be called every ~50 ms.
Well, method 1 is just silly! try this instead:
And that ought to explain why I won't delve into the other methods.
12-04-2014 11:27 AM
Type Cast man is angry, very angry. You won't like Type Cast man when he is angry....
12-04-2014 11:30 AM
@Darin.K wrote:
Type Cast man is angry, very angry. You won't like Type Cast man when he is angry....
Well, I don't see any booleans (green), so he can't be that angry...
12-04-2014 11:37 AM
12-04-2014 11:56 AM
All the elements in the cluster are not the same type. Some are doubles, some are U32, etc. Sorry for the confustion. I created a Demo code just to show basicof what i was trying to accomplish.
12-04-2014 11:58 AM
12-04-2014 12:20 PM
@altenbach wrote:
Typecast is definitely the choice for the experts.
... but of course the the next newbie will wire a sgl or integer array and expect a benign coercion to a dbl cluster. 😮
What about the newbie that wonders why only 9 of his elements are in the cluster? Also fun to discover that Array to Cluster followed by Cluster to Array is not always a no-op...
Seems the types are different, in that case I would use method 1 (simple bundle by name). The compiler figures out inplaceness pretty well on its own for this case. I would not use the IPES unless I had real evidence that it was necessary for performance reasons.