jmax007 Posted May 28, 2009 Report Share Posted May 28, 2009 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. Quote Link to comment
LAVA 1.0 Content Posted May 28, 2009 Report Share Posted May 28, 2009 There are several options: INI-FilesFor 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 XML-FilesFor this type I recommend the JKI XML Toolkit, it behaves like the OpenG Variant Config tools. Plain binary dataYou 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 Quote Link to comment
Greg Hupp Posted June 2, 2009 Report Share Posted June 2, 2009 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"> 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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.