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: 

Number conversion

Solved!
Go to solution

Hi,

 

I am doing a program where I have to take two numbers from one array and I havet to concatenate them. The problem is, that when I take the number 2, it only takes the number 2 and I want to take 02. Is there any conversion, in Labview, to see the number 02 instead of number 2 only?

 

Best regards

0 Kudos
Message 1 of 7
(2,331 Views)

Hi 99,

 


@labview99 wrote:

Is there any conversion, in Labview, to see the number 02 instead of number 2 only?


Yes.

 


@labview99 wrote:

I am doing a program where I have to take two numbers from one array and I havet to concatenate them. The problem is, that when I take the number 2, it only takes the number 2 and I want to take 02.


After all your discussion threads you still haven't learned to provide an example VI with your input array and the expected output?

What exactly are you talking about? Which kind of array? Which datatypes?

Best regards,
GerdW


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

I simply want to convert the number 2 to 02, is tehre any conversion to do it?

Thank you

0 Kudos
Message 3 of 7
(2,324 Views)
Solution
Accepted by topic author labview99

Hi 99,

 

use FormatIntoString with a proper format code. Read the help for those format codes…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(2,321 Views)
Solution
Accepted by topic author labview99

Use Format Into String with %02d.

 

%02.0f, %02x and %02o work as well for 2 of course.

0 Kudos
Message 5 of 7
(2,318 Views)

You can't change a numeric value to 02, because the value is 2. It's only when showing the value (by converting it to a string or displaying it in an indicator) that the formatting specifies how it's being displayed.

 

If you don't want to convert the number to a string, but instead have a numeric control or indicator, change the formatting of the control or indicator (to %02d). 

0 Kudos
Message 6 of 7
(2,293 Views)

Thank you everybody for your help! I have tried and it works okey!!

 

Best regards

0 Kudos
Message 7 of 7
(2,284 Views)