The OpenG VIs that I couldn’t live without

Posted on Sunday 25 March 2007

One of my not so well kept secrets is that I really love to use OpenG’s free software libraries when I write software (using LabVIEW, of course). Yes, I’m a little biased (OK, a lot biased) because I have had a significant role in the development of these tools. That aside, I’m pretty sure that most people would agree with me that these are really great tools.

On a regular basis, I’m going to be providing, here on Thinking in G, glimpses at some of libraries and VIs that I could not live without — the tools that I use, every day, in every LabVIEW project (literally). I’ll try to explain why they are so useful and show some examples of how to use them.

For this first article, let’s start out by looking at my all time favorite OpenG library, the Variant Configuration File VIs. But, first, in order to use these VIs, you need to understand what a Configuration File (a.k.a, “INI” file) is. Quickly, go take a look at the wikipedia definition of “INI File”. Done, yet? OK, let’s move on.

Variant Configuration File VIs paletteBasically, the Variant Configuration File VIs (shown to the right) accept a variant input and will write the variant data to an INI file, or read the INI file and write the data to a variant. To use these VIs, you don’t really need to understand Variants. All you need to know about them is that they are a “magic” data type that that allows you to wire up any other data type to it — this means that you can pass anything into the Variant Configuration File VIs and it will get written to or read from an INI file. I bet you’re thinking, “Why didn’t you just say that in the first place, Jim. That’s amazing!” Yes, it is amazing and that’s why these VIs are my absolute favorite OpenG library. OK, now let’s take a look at how to use these VIs.

After installing VI Package Manager (VIPM) and downloading and installing the Variant Configuration File VIs (the oglib_variantconfig package from within VIPM ), you will find the Variant Configuration File VIs palette in the Functions palette under the OpenG submenu. (See here for a quick guide on how to install OpenG on VIPM.)

For writing data to an INI file, use Write Section Cluster, as shown below.

Write Section Cluster Example

For reading data from an INI file, use Read Section Cluster, as shown below. Reading the data from file requires that we pass the type into Read Section Cluster. The output is a variant, which we must convert back into our cluster using the Variant To Data function.

Read Section Cluster Example

As you can see, these VIs use the names of each of the cluster elements as key names in the INI file. This saves you tons of time, as compared to reading and writing individual keys, the old fashioned way. It’s easy to see why these VIs are at the top of the list of OpenG VIs that I couldn’t live without.

[Update] For a list of all the articles in this series, click here.


3 Comments for 'The OpenG VIs that I couldn’t live without'

  1.  
    freya
    December 28, 2008 | 7:16 pm
     

    I’m interesting in this Vi,and I try to download it ,but I haven’t get any useable link。can you do me a favor to offer one?Thanks!

  2.  
    Ton Plomp
    December 28, 2008 | 10:47 pm
     

    Hi Freya,

    After installing VI Package Manager (VIPM) and downloading and installing the Variant Configuration File VIs (the oglib_variantconfig package from within VIPM ), you will find the Variant Configuration File VIs palette in the Functions palette under the OpenG submenu. (See here for a quick guide on how to install OpenG on VIPM.)

    This refers to this site.

    Ton

  3.  
    Art Escobedo
    December 1, 2016 | 2:45 pm
     

    I cant get the Cluster Read Section Cluster to work.

    I get no errors but it will not Read from my INI file.

    My write config.ini VI works. I’m using the same example above. What am I missing?

Leave a comment

(required)

(required)


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 741 access attempts in the last 7 days.