LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string convert to array

Solved!
Go to solution

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, 

0 Kudos
Message 1 of 14
(3,552 Views)

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

0 Kudos
Message 2 of 14
(3,550 Views)

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

0 Kudos
Message 3 of 14
(3,546 Views)

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

0 Kudos
Message 4 of 14
(3,537 Views)

(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. 

Message 5 of 14
(3,524 Views)
Ok but I use Labview 7.1 and  I don't find the read from spreadsheet?
0 Kudos
Message 6 of 14
(3,517 Views)
It's there.
0 Kudos
Message 7 of 14
(3,515 Views)

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

0 Kudos
Message 8 of 14
(3,483 Views)

Can you attach an actual txt file?

 

This should be quite trivial. 😉

Message 9 of 14
(3,472 Views)

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!

0 Kudos
Message 10 of 14
(3,468 Views)