LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Where does Labview save variables?

To summarize what I think you want:
Read from file, display what is read, allow user to change some of those values, write back to the file overwriting the previous values
Is this correct?

This is incredibly easy to do in LabVIEW. I hate seeing "but it looks like it'll have to be done another way", because I see that a lot and it's always when the speaker just doesn't know the capabilities of the language. My signature has a link to the unofficial rules, at the bottom of which there is a list of some free tutorials. These can help you get a grasp of what LabVIEW is capable of (nearly anything).

As for your specific problem, you should look in to the File I/O palette. The easiest thing for you might be to just use the Read From Spreadsheet and Write to Spreadsheet File VIs. When you have the new user inputs, you can overwrite the same file that you read from with the new data.
When you read from the file, there will be a file path wire that can be used to pass the file path around wherever you want. You can use this wire to pass the exact same path from the Read node to the Write node.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 11 of 16
(1,223 Views)

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.  

0 Kudos
Message 12 of 16
(1,190 Views)

@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?  

aputman
Message 13 of 16
(1,157 Views)

@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>   ---'


0 Kudos
Message 14 of 16
(1,148 Views)

@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,...).

0 Kudos
Message 15 of 16
(1,125 Views)

@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.

0 Kudos
Message 16 of 16
(1,122 Views)