LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

In Place Structure questions

Solved!
Go to solution

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. 

0 Kudos
Message 1 of 11
(3,294 Views)
Solution
Accepted by topic author sticyfinger

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 11
(3,279 Views)

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?

Message 3 of 11
(3,259 Views)

@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:

Capture1.PNG

And that ought to explain why I won't delve into the other methods.

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 11
(3,254 Views)

Type Cast man is angry, very angry.  You won't like Type Cast man when he is angry....

 

TypeCastDBLArray.png

Message 5 of 11
(3,243 Views)

@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...


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 11
(3,236 Views)

HulkTypeCastMan.png

Message 7 of 11
(3,230 Views)

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. 

 

 

 

0 Kudos
Message 8 of 11
(3,206 Views)
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. 😮
0 Kudos
Message 9 of 11
(3,202 Views)
Solution
Accepted by topic author sticyfinger

@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.

Message 10 of 11
(3,183 Views)