LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using spreadsheet function to convert string to 1d array

Solved!
Go to solution
Remember that the Spreadsheet String to Array function's lower left input is for the array type.  In this case a 1-D array of double.  It doesn't define a default value for the data so the empty NaN array isn't doing anything different than an empty 0 array, or even a 1-D array that contains actually contains data in its elements.
Message 11 of 51
(11,070 Views)

Hello !

 

I have another question concerning this post.

 

If the txt file contains 2 columns, how can i export it's content to a 2D array ?

 

Thak you very much 4 your time and patience !

 

P.S. Using LabView 8.5.1 on Windows XP SP 2

0 Kudos
Message 12 of 51
(11,065 Views)
Let's say that the txt file is like the one attached.
0 Kudos
Message 13 of 51
(11,064 Views)
Sorry. The solution is using read from spreadsheet.vi .
0 Kudos
Message 14 of 51
(11,058 Views)

From the example I posted earlier, all that is required is a small change.

The delimiter becomes a space and use the 2D output (all rows). Also do not transpose the array, so the boolean becomes False.

 

See code

 

Message Edited by Ray.R on 01-06-2010 12:22 PM
Message 15 of 51
(11,039 Views)

Hello to all!! I need to convert string of numbers to 1D array (Need to get each value of string to one column in array). Help please.

0 Kudos
Message 16 of 51
(10,400 Views)

 

Hi Anjella,

 

you should use SpreadsheetstringToArray, wire the correct delimiter char, default datatype and format specifier and you're done...

For any specific help you should give an example of your "string of numbers"!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 17 of 51
(10,397 Views)

Thanks for replying 🙂 .

This is my example.

lab1.png

I realised the problem in this way 

0 Kudos
Message 18 of 51
(10,392 Views)

Hi anjelly,

 

so your problem is to convert exactly one number from string to DBL? Why don't you use a function from the string conversion palette?

Where do you have your "string of numbers"?

 

In your example you didn't wire the delimeter nor format string nor default datatype...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 19 of 51
(10,389 Views)

Lab2.pngbut i want to find solution using SpreadsheetstringToArray function.

0 Kudos
Message 20 of 51
(10,388 Views)