03-04-2009 07:56 AM
Hello,
I want to convert a file of strings in an array!
What I need is to have each one line of my file convert to one line of the array, so that i will be able to make a loop with a For cycle!
Thanks,
Solved! Go to Solution.
03-04-2009 07:59 AM
use "Read from spreadsheet" function to read data from the file and search for End of line character and separately store in the array.
Post what you have done till now.
We can guide you further
03-04-2009 08:31 AM
Hi mathan,
Thanks for your help, find attached a picture of my function.
I can only read 0 instead of my line? that should after that enter in my while with condition for each line.
Thanks
03-04-2009 09:02 AM
Should I change something on the properties of my spread sheet?
I have only Zero when i read the value of my spread sheet
Thanks for your support
03-04-2009 09:09 AM
(Side note: This is like the third spreadsheet file related post this morning.)
Let's make sure of one thing first: You're working with a text file, right? You're not trying to read an Excel workbook, right? 'Cause if you are, forget it. Neither the Read from Spreadsheet File nor what you're doing will work. For Excel you need to use ActiveX or ADO. IF you're working with a text file, why don't you just do what mathan suggested, and use the Read from Spreadsheet File? It's a lot simpler. Specific to your case: You are configuring the Spreadsheet String to Array to use a format of %s (meaning you want to parse strings), but are feeding an array of numbers as the array type. These are contradictory. If you want to read numbers, the format string should be %d for integers and %f for floats. There are other format strings, but those 2 are the basic ones.
03-04-2009 09:20 AM
03-04-2009 09:23 AM
03-05-2009 02:42 AM
Hello thanks for this but it seems not to be what I want...need to check it!
Let me re explain what I need,
my TXT file is made with different line like :
point 1; voltage 2; current 0.5;
point 2; voltage 3; current 0.7;
etc..
and I need to store them in an array to be able to use each line during my sequence (for & while to set different timing )
Tx
03-05-2009 03:44 AM
03-05-2009 03:52 AM
ok find attached my txt file!
Each line represent one point!
In my previous function I was loading a file for each point (for loop) to be able to do each test!