I am trying to import a table from excel (a csv file) to a numeric table in PAC control. I was trying to use a communication handle and according to the status the communication handle was opened just find. I was trying to use the “ReceiveNumTable” command.
Does your csv file have multiple rows and multiple columns? A numeric table in PAC Control is only a single dimension, so you may need a numeric table for each column in your CSV (Depends on what you want). Can you post a sample of your data and how you want it stored in PAC Control?
Yeah my csv file has two dimensions, It has two columns and about 50 rows. I do want separate numeric tables for each column. My data is pretty simple, the first column is list of masses and the second is a list of lengths. All I want done is the first column in my csv to be in its own numeric table and the second column to be in another.
Keep in mind, your file is made of strings that represent your data, so you’ll likely want to use the SetEndOfMessageTerminator command so your delimiter is a comma.
Next you’ll use the ReceiveStrTable command to pull your file into on long string table where each element is one value, then loop through and use a command like StringToFloat or StringToInt32 to convert each of those strings into the data type you really want.
With few modifications of the above code you should be able to parse down into individual rows (or use the ReceiveStrTable command as Mary mentioned and loop through the string table). Once you have a single row, you will need to parse the individual rows for the comma, convert from string to float (there’s a command for that) and then store in your table.
I have a subroutine I use to parse strings that takes a delimiter as a parameter and a position and returns the parsed item which will help with parsing at the row level: