From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array data type conversion

Solved!
Go to solution

I have a simple problem.

 

I have a 2D array of string type. The array is a table with column names, and rows which are numbers.

I want to extract the rows, but I want them to come out as numbers so I can do some line fitting to them.

 

Do I need to select each element and convert from string to number?

 

Is there a function that converts a string (pink line) to a number (orange line)?

 

Is there a smarter way?

0 Kudos
Message 1 of 7
(6,265 Views)

Try this...

 

on the blockdiagram right click go to programming-->strings-->string/numberconversion-->fract/exp stringtonumber

 

Thanks

Robin

Message 2 of 7
(6,262 Views)

Thanks. Your solution works but element-wise.

But is there a VI that applies to the whole 2D array to change its type?

0 Kudos
Message 3 of 7
(6,254 Views)

Spreadsheet String to Array in the String palette.

 

Lynn

0 Kudos
Message 4 of 7
(6,244 Views)

Put the 2D array through a For loop.  See attached.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 5 of 7
(6,242 Views)
Solution
Accepted by topic author murchak

@murchak wrote:

Thanks. Your solution works but element-wise.

But is there a VI that applies to the whole 2D array to change its type?


??

 

It works on an entire array at a time in my version of LabVIEW!

 

 

Message 6 of 7
(6,234 Views)

It does indeed work on an entire array. Thanks!!

0 Kudos
Message 7 of 7
(6,201 Views)