In Place Element Strucure – Saves Time and Prevents Bugs

Posted on Tuesday 29 January 2008

The designers of LabVIEW added a new function to LabVIEW 8.5 called the In Place Element Structure . The idea behind this structure is that it allows memory efficient operations on sub-elements of compound data structures like Clusters, Arrays, Variants, and Waveforms. However, it also has a the unintended benefits of saving developers time and helping them prevent bugs . Let me explain...

Example 1 - Modifying an Element of a Cluster

Traditionally, if you wanted to perform an in-place operation on an element of a cluster, you would unbundle it, operate on it, and bundle it back into the cluster, like this:

And, here is how you would do it with an In Place Element Structure :

Example 2 - Modifying an Element of an Array

Traditionally, this is how you would convert one element of a string array to lowercase:

" zid="49" />

And, here's how we would do it using an In Place Element Structure :


While the difference between the traditional way of performing an in place operation doesn't look remarkably different from how you would do it with an In Place Element Structure , there are some real advantages to using this new structure:
  • Saves time :   fewer nodes, fewer wires, fewer mouse-clicks
  • Code is cleaner : fewer wires
  • More maintainable : The unbundle and bundle nodes of the In Place Element Structure stay synchronized (you change one and the other changes to match it).
These may not be the reasons that LabVIEW's designers added the In Place Element Structure to LabVIEW 8.5, but these are the reasons that I use it. I'm constantly trying to find ways to code faster, cleaner, and with fewer bugs. In fact, I'm surprised that the only place to find this structure is buried down in the Programming>>Application Control>>Memory Control Functions palette. I always expect to find it in the Programming>>Structures palette and I'm disappointed each time ;)

11 Comments for 'In Place Element Strucure – Saves Time and Prevents Bugs'

    January 29, 2008 | 8:51 am

    Nicelydone and perhaps this will induce NI to migrate the In Place Element Structure ot the STRUCTURES palette — where it belongs!

    January 29, 2008 | 10:37 am

    In the future, there will be more structures that are not in the “Structures” palette. This palette has turned out to be a bad idea as structures are added that relate to specific aspects of LabVIEW. The general “flow of control” structures will remain where they are, but others may appear in palettes specific to their purposes. The Inplace Element Structure is merely the first of these.

    As always, the phrase “in the future” has no bounding when I use it to describe LabVIEW, and you may not see anything along these lines for many years.

    January 30, 2008 | 2:25 am

    Why can’t it be in both locations? In the Memory Control palette AND the structures palette?
    In any case NI yet again seems to be out of touch with how the typical user “uses” the LabVIEW environment.

    Matt Holt
    January 30, 2008 | 9:54 am

    – Rant on –
    I agree with Mr. Aivaliotis, NI doesn’t recruit from Industry enough for the dev teams to have any real knowledge of how the average user interacts with the software.
    – Rant off –

    I put the memory control sub palette on the structures palette, not a great solution, but at least the structure is accessible this way. It would be great if we had the ability to fully customize the palettes versus just adding other palettes and VIs…. as in, copy the link from the memory control palette to the structures palette at our choosing.

    Chris Davis
    February 1, 2008 | 5:29 am

    I can’t see the code snippet images you’ve put in your blog. I’ve tried IE7 and Firefox 2, but it could still be something on my end. I’m assuming everyone else can see them right?

    February 1, 2008 | 10:40 am

    Chris: I did something a little different with the images, this time. I hosted them on Flickr. Is blacklisted by your IT dept?

    Chris Davis
    February 4, 2008 | 12:41 pm

    I haven’t tried it myself yet, but I think this proves that flickr is blocked by my IT department. Thanks for your blog.

    February 5, 2008 | 10:20 am

    Chris: I’ve made the images local. You should now be able to see them.

    Patrick Lavezza
    February 5, 2008 | 10:49 pm

    Someone just posted this bug to NI’s forums.

    Patrick Lavezza
    February 5, 2008 | 10:50 pm

    Sorry, I messed up the link.

    February 6, 2008 | 10:11 am

    Patrick: That looks like a nasty bug. Thanks for link.

Leave a comment



Information for comment users
Line and paragraph breaks are implemented automatically. Your e-mail address is never displayed. Please consider what you're posting.

Use the buttons below to customise your comment.

RSS feed for comments on this post |


Bad Behavior has blocked 772 access attempts in the last 7 days.