LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert multiple length numerics to string for a table

Perhaps I am over complicating this, but the solution evades me.....

 

I have a mix of numeric types (lengths) that I want to display in a table together.

 

is there an easy method to do a "convert to string" on a 2d array that displays all differing lengths of numbers?

 

If I use Fractional convert on the array I end up with numbers all being the same length, see below.

 

 

eg. How I want it displayed: (note the varying lengths of numerics)

 

Applied Volts

Frequency

Duration

Range

0.018

50

5

0.04

0.1

50

5

0.4

0.45

50

5

1

1.8

1000

10

4

45

10000

10

100

 

 

Not how I want it: ( all at 3 dec places)

Applied Volts

Frequency

Duration

Range

0.018

50.000

5.000

0.040

0.100

50.000

5.000

0.400

0.450

50.000

5.000

1.000

1.800

1000.000

10.000

4.000

45.000

10000.000

10.000

100.000

0 Kudos
Message 1 of 4
(2,218 Views)

How do you define which cells have which formats? Is the numeric data in an array or does it come from multiple sources?

 

Lynn

0 Kudos
Message 2 of 4
(2,215 Views)

My routine reads in all those values in the table from a CSV file and converts them to numbers to control the instrumentation and perform calcs.

 

Just dawned on me that I could grab the raw string data as soon as I have read it from the CSV and push it straight to the table.

 

However, I am still curious if there is an easy way to represent varying length numerics in a table together. Ie I don't want set a length of 2, 4, or 6 etc, I just want the total number of digits shown in the table.

 

0 Kudos
Message 3 of 4
(2,203 Views)

Hi Adam,

 

it's all in the LabVIEW help: read about those different string formatting codes!

 

I would try something like "%#.6f" to get rid of trailing zeros…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(2,173 Views)