08-15-2017 06:18 AM
Hello,
I have a 2 x 2 array of string and I wish to extract each row incrementally from an example similar to the one below.
So all the columns from the first row need to be extracted before moving onto the next row.
I want to parse each row through a state machine to manipulate the DAQ channels i.e. Analogue Output and Analogue Input.
CrossRulz posted a solution previously with the VI illustrated below:
I still want to have the capability of ignoring the // in the tab delimited text file to enable commenting for the user.
Many Thanks
Solved! Go to Solution.
08-15-2017 07:00 AM
Looks like a solution, what is the question?
08-15-2017 07:28 AM
here is a state MC that read the 2D array and ignore the "//" s
Replace the states enums with your state enum and make that a type def !
However I would choose a queued state MC.
08-15-2017 08:03 AM
@neunited wrote:
Hello,
I still want to have the capability of ignoring the // in the tab delimited text file to enable commenting for the user.
Many Thanks
I haven't looked that closely at the previous solutions, but I believe that they only ignore comments where the line BEGINS with the //.
There are probably better ways to do this. But the snippet below will strip out all comments, indented comments, In-Line Comments, and empty lines.
08-15-2017 11:03 AM - edited 08-15-2017 11:03 AM
Hi Jamiva,
Thanks for the example you provided. Your VI enables commenting to be far more fool proof as it should be .
I suppose the final aspect which I still don't fully understand is how to parse the data into DAQmx function blocks. .
I want to be able to extract the data one row iteration at a time which will read all the columns of that row before moving onto the next row, and then have the case structure recognize whether it is a "set" or "confirm" before following the task. It also needs to be able to read through the remaining columns of that unique row and update the DAQmx function to the output voltage.
So in general I just don't understand what functions I should use to find connection compatibility with DAQmx functions.
I hope my objective makes sense, if not feel free to ask me more questions.
Many Thanks
08-15-2017 11:11 AM
Quick tip: Instead of Read From Text File followed by the Spreadsheet String To Array to make an array of your rows, just right-click on the Read From Text File and check the Read Lines option. Then wire a -1 to the count input. This will read all of the lines of the file and output an array of strings.
@neunited wrote:
So in general I just don't understand what functions I should use to find connection compatibility with DAQmx functions.
Well, that depends completely on which functions you want to do. Before you try to figure out parsing, play around with the DAQmx functions to figure out what you need. Read the help files. Once you have that figured out, then it will be a matter of Index Array and then whatever string conversions are needed.