Jump to content

Read from file to Cluster


Recommended Posts

I am new here to LabVIEW and was hoping for some recommendations.

I need to read the data from a file/spreadsheet, into an array of clusters. This sounds like something that must be common, but I can't seem to find a good example

Basically I have an excel sheet that contains setup information that I want to load into an array of clusters.

row1 is a cluster, row two is a cluster etc...

Since I am new to LabVIEW, I can imagine that I could use the "read from spreadsheet.vi" , but it only allow me to read the whole file as one data type. I could do this several times reading from the same file, but using a different data type each time, then using indexing to parse the data and create my cluster of arrays.

This sounds ugly and I am guessing there might be an easier way to actually read a file into an array of clusters. If not, then I will do it the "long route"

I am using LV8.6 and the file format is not important because I will be writing and maintaining the setup information.

This forum has been a great help so far and I thank everyone who uses it.

Link to comment

There are several options:

  1. INI-Files
    For this type I recommend the OpenG Variant Config tools, it allows you to easily read and write random data to a file in a human readible form
  2. XML-Files
    For this type I recommend the JKI XML Toolkit, it behaves like the OpenG Variant Config tools.
  3. Plain binary data
    You can use the binary read/write functions to store the data directly to disk, disadvantage is that if you change your datatype your files will be useless, and you cannot edit the data with an other editor

There are other options as well, I usually use the OpenG or JKI routes.

Ton

Link to comment

QUOTE (jmax007 @ May 26 2009, 06:45 PM)

I am new here to LabVIEW and was hoping for some recommendations.

I need to read the data from a file/spreadsheet, into an array of clusters. This sounds like something that must be common, but I can't seem to find a good example

Basically I have an excel sheet that contains setup information that I want to load into an array of clusters.

row1 is a cluster, row two is a cluster etc...

Since I am new to LabVIEW, I can imagine that I could use the "read from spreadsheet.vi" , but it only allow me to read the whole file as one data type. I could do this several times reading from the same file, but using a different data type each time, then using indexing to parse the data and create my cluster of arrays.

This sounds ugly and I am guessing there might be an easier way to actually read a file into an array of clusters. If not, then I will do it the "long route"

I am using LV8.6 and the file format is not important because I will be writing and maintaining the setup information.

This forum has been a great help so far and I thank everyone who uses it.

http://lavag.org/old_files/monthly_06_2009/post-12023-1243878714.jpg' target="_blank">post-12023-1243878714.jpg?width=400

You can always read it in as an array of strings using test file read...the parse using the scan from string function (if you know the format of the data AND it is always constant). Otherwise you can using other scan functions to break up the string by delimiter (tab if it is a spreadsheet) and parse it that way.

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.