LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read settings from a file

Solved!
Go to solution

I'm writing a data logger program that may be used to log up to nine or ten channels at a time. Because there is basically no way to remove channels from a task, my program requires that you get the setup right on the first try or you have to start over. I imagine that process would get old fast, particularly if the same test is being done over and over again.

 

So my question is, how could I save the control inputs, or the DAQmx task, or something to a file which could then be loaded instead of entering everything manually each time?

 

I have attached a VI from the standard examples which I have based my program on, and I have attached a picture of what I actually have.

Download All
0 Kudos
Message 1 of 4
(2,017 Views)
Solution
Accepted by topic author duwaar

Well I really like using XML files for this but they can be hard to work with specially for end users that are not technical minded.

 

The simplest way I have come up with is create a DETAILED template in Excel that instructs the user to save the file as a .CSV, like this:

Template.PNG

Then using the "Read Delimited Spreadsheet" vi I read that file and pull out the values for my program.

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 4
(1,993 Views)

In the past, I used a configuration file to read all of the channels and their settings and then used the DAQmx Create Virtual Channel to add each channel to the task.  If I were to redo it now, I would use JSON or XML.  There are plenty of libraries for each.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 4
(1,991 Views)

BTW: Here is how I read the CSV "test script" file and parse it to load the values into my "Test Cluster"...

 

ParceCapture.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 4
(1,975 Views)