Hello,
I have a comma delimited text file which is initialised into an array using the VI below.
The issue is that I have to place additional commas in order to make the array larger to provide additional empty columns.
For example:
Dog, Cat, Rabbit, , , ,
This script provides an array which is 7 columns wide.
Is it possible for the initialization of the array to be formatted automatically with LabVIEW functions without having to use additional commas in the text file to be set to 7 commas?
Would appreciate any feedback you may have
Many Thanks
已解决! 转到解答。
Use the Initialize Array VI to create an array of size 7 and replace a subset of that array with the data from your file. Use the Read From Spreadsheet function to make that part of your code cleaner.
Yes. The only thing you might have to do is to make sure the index you are inserting into is either in the middle of the array, or is equal to the size of the array so that it will add the column to the end. (i.e., you can't insert a column at column #7 if you only have 3 columns in the array.) And remember that row and column indices start at 0. So a 7 column array has columns at indices 0, 1, 2, 3, .... 6.
Can you attach a simple text file and a simple script file. All this seems overly complicated.
Try using the built-in function: Spreadsheet String to Array
Hi Altenbach,
Thanks very much for illustrating that example, it was spot on for what I want to achieve.
I attached another example VI for others to check out in case they have a similar problem.
Many Thanks