Jump to content

Work in-place on a cluster element chosen at runtime?


ned

Recommended Posts

I have a cluster containing two identical child clusters. At runtime I want to unbundle one of those child clusters, do some work on it, and bundle it back into the parent cluster. Is it possible to do this in-place? Even with the new memory management structures I can't figure out how one would accomplish this without using a case structure and creating one case for each child cluster. Am I missing some good explanation as to why this isn't possible? This is mostly curiosity, as my child clusters are small enough that creating a copy isn't a problem.

Link to comment

I'd do this:

Cluster contains two child clusters, Alpha and Beta.

Case structure to decide which child cluster you want to operate on. In Frame Alpha, drop an In-place Element Structure to unbundle Alpha. In Frame Beta, another In-place Element Structure to unbundle Beta. Then call the same subVI in both frames, with the cluster passed in and coming out again on the other side of the subVI. Note that if you need other elements from the parent cluster in order to do the operation, those should be unbundled in both frames and passed into the subVI as well.

Second option:

Don't use two child clusters. Instead use an array of clusters with two elements. Then you can index which element you want to use.

Link to comment

I realized after posting that I can do the two-element case with a matching pair of "Swap Values," taking advantage of the boolean input. I suspect that can be expanded to the general case, but would get messy in a hurry.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.