LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using spreadsheet function to convert string to 1d array

Solved!
Go to solution

Hi johnny,

 


most often the problem is with the system's regional settings. You probably use the comma as decimal separator (as is standard for Germany) and so this functions doesn't recognize "34.123" as float number.

Either

- use the point as decimal separator in the OS settings

- use the format string "%.;%f" instead

- convert all comma to semicolon and all points to comma (in this order!), then use "%f" with a semicolon as delimiter

 

Another (Very seldom) reason may be: the user has wired an INT datatype in the type input...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 41 of 51
(1,883 Views)

Thank you so much GerdW!!!

The format that you gave me didn't work actually,but I did that with the OS settings and now I m getting the results I want!

Thank you again,I woulnd't find this by my self!

0 Kudos
Message 42 of 51
(1,859 Views)

Hi All,

 

Anybody can help me urgently to convert attached text into 1d string array.

Please ignore any symbol. Just 1 row text into 1 row array & continous.

 

Thanks in advance

Sufian

0 Kudos
Message 43 of 51
(1,750 Views)

Hi yanz,

 

you could use the basic ReadSpreadsheet File:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 44 of 51
(1,744 Views)

Hi GerdW,

 

There is an error "not enough memory" generated.

Currently, I am using Windows7 & Labview 2010.

 

Actually, this is large text file (2xxMB) & I still fighting to do conversion faster.

0 Kudos
Message 45 of 51
(1,733 Views)

You could try reading the file one line at a time and convert the one line to an array.  You can then use autoindexing out of the While loop to build up your 2D array.

 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 46 of 51
(1,726 Views)

Hi GerdW & Crossrulz,

 

I have found a better & fastest way for conversion as per attached.

I also decided to use 2D array rather than 1D array.

 

Thanks for your feedback

Sorry for inconvenience caused

0 Kudos
Message 47 of 51
(1,720 Views)
You should never use better and faster top describe a VI with local variables.
0 Kudos
Message 48 of 51
(1,709 Views)

Does anyone have a solution to the OP's question using the spreadsheet string to array?  I am having the exact same problem where my strings are only showing up in the first element.  

 

Apparently you guys love reading from a file, but I don't have the luxury of piggybacking that file into every distribution of the executable, so I want to hard code this portion into the VI.  Please suggest a solution using the spreadsheet string to array.  

 

Attached is an image showing why spreadsheet string to array is so useful for me.  It avoids the painstaking task of wiring up allll of these strings to a build array and then hoping that everything is in the right order.  With spreadhseet string to array, then i can just copy and paste from a spreadsheet to *hardcode* this into the vi AND I don't have to wire up all these strings across multiple screens AND I don't have to make sure they're in the right order.  I can just copy and paste! 🙂  Thanks. 

0 Kudos
Message 49 of 51
(1,642 Views)

I figured it out!!!  Arghhhh labview.

 

I had to use a 2D array! and then chop it back down to a 1D array. Even though I wanted a 1D array in the first place, labview couldn't read my mind.  I struggle with labview so much. 

 

IN the attached image, "array" is a 2D array of my strings.  And then "subarray" is of course the 1D version that I want.  This will serve as the solution to the OP's question for future reference.  Thanks guys.

0 Kudos
Message 50 of 51
(1,635 Views)