09-21-2015 06:34 PM
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
09-22-2015 05:58 AM
I would advise against writing custom functions to read/write to a custom file format. Your data is a cluster containing an array of clusters of four numerics, plus an array of filenames. Personally, I would use JSON format for such a thing. Then its a single function to convert to/from the cluster, and you have one wire containing your data.
09-22-2015 08:52 AM
@drjdpowell wrote:
I would advise against writing custom functions to read/write to a custom file format. Your data is a cluster containing an array of clusters of four numerics, plus an array of filenames. Personally, I would use JSON format for such a thing. Then its a single function to convert to/from the cluster, and you have one wire containing your data.
So you advise against writing custom functions but then you recommend using one of your own custom functions?
09-22-2015 09:00 AM - edited 09-22-2015 09:01 AM
@drjdpowell wrote:
I would advise against writing custom functions to read/write to a custom file format. Your data is a cluster containing an array of clusters of four numerics, plus an array of filenames. Personally, I would use JSON format for such a thing.
I was purposefully steering OP towards the simple spreadsheet VIs because they're the easiest for newbies to understand when they're first working with File IO. Most anyone can understand the functionality of writing an array of data to file and being able to read it as such if they open the file outside LabVIEW. The flatten/unflatten type of operators are great and I use them myself in my applications, but they're easy to mess up when you change your datatype. It's quite easy to add a new element to the end of an array.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
09-22-2015 10:11 AM
@aputman wrote:
@drjdpowell wrote:
I would advise against writing custom functions to read/write to a custom file format. Your data is a cluster containing an array of clusters of four numerics, plus an array of filenames. Personally, I would use JSON format for such a thing. Then its a single function to convert to/from the cluster, and you have one wire containing your data.
So you advise against writing custom functions but then you recommend using one of your own custom functions?
By "custom" I mean code and a file format specification made specifically for this application. It's a lot of work (with lots of bug potential) to do everything from scratch. Better to use a reusable library based on a standard format (JSON, INI, XML,...).
09-22-2015 10:15 AM
@James.M wrote:
I was purposefully steering OP towards the simple spreadsheet VIs because they're the easiest for newbies to understand when they're first working with File IO. Most anyone can understand the functionality of writing an array of data to file and being able to read it as such if they open the file outside LabVIEW. The flatten/unflatten type of operators are great and I use them myself in my applications, but they're easy to mess up when you change your datatype. It's quite easy to add a new element to the end of an array.
A good point, though it would still be tricky to parse the OP's desired two-array file with headers. But if he divided things into two files then spreadsheet to array would work very simply.