LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Numeric

Can I just check if there is a way to display a number as 01 instead of 1 when using the numeric datatype. I can do it when it is in string format but it will take away the 0 when it is displayed in terms of numeric. Also I need to display the numbers as 01 to 09 if the input is less than 10, so i'm thinking of using a case structure to do this. So that for the case less than 10, it will add a zero in front, if not it will just dsplay the number. Is case structure the correct method or there is other better way. Thanks!
0 Kudos
Message 1 of 10
(3,402 Views)
Right click on the control, select 'Properties', look for a tab called 'Disply Format'
Select 'Use minimum field width' (2), Pad with zeros on left.

Or use the Advanced editing mode:
%02d

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 10
(3,397 Views)
To display on the front panel numeric with a 2 digit minimum format (eg 03), right click on the control/indicator. Choose "Display Format". Check "Use minimum field width". Change the number to 2 or however many digits you wish to display. From the drop down list choose "Pad with zeros on left".

Problem solved.
0 Kudos
Message 3 of 10
(3,396 Views)
Hi thanks for the help, Another thing is that i need to write it to a file in binary format So wat is the way to have the 0 in front as well while having it in numeric and not string Thanks!

Message Edited by 1000 on 01-14-2008 09:51 AM
0 Kudos
Message 4 of 10
(3,379 Views)


1000 wrote:
Hi thanks for the help, Another thing is that i need to write it to a file in binary format So wat is the way to have the 0 in front as well while having it in numeric and not string Thanks!

The leading zeros are just a cosmetic display property and have nothing to do with the underlying data. A binary file typically does not contain formatting information, so it is not clear to me what you actually want here. can you elaborate?
0 Kudos
Message 5 of 10
(3,356 Views)
I need the no. of digits to be constant throughout. For example for 2digit data, i need it to be 01 to 99. I need it so as to have proper documentation for other users of the labview programme. It is because the data will be combine together and it may form numbers like 019901, so with the constant no. of digits, i can label them as every 2digits will represent which set of data, just like for date i can say ddmmyy. Thanks!
0 Kudos
Message 6 of 10
(3,325 Views)
Well, you said you wanted a binary file. In this case you don't have to worry, because the size taken is entirely determined by the representation (e.g. 8 bytes/DBL).
 
Now it seems you want a formatted ASCII file. In this case you would use the same format specifiers as discussed above. Easiest would be to format your record as a string and then write the string to the file.
0 Kudos
Message 7 of 10
(3,311 Views)
HI! I'm i right to say that i'll convert it to string then use case structure to add the 0 for those which are less than 10. Then combine the various '2digits' together and convert IT back to numeric. I think if the final value has the first digit as 0, it will be deleted off when i convert it back to numeric. I need to have it in numeric as the final datatype.
0 Kudos
Message 8 of 10
(3,306 Views)
Hello 1000,
 
the conversion from the number to a string is very simple. See the attached file. And like already written the information of the size is only known in string format.
 
Mike
0 Kudos
Message 9 of 10
(3,304 Views)
Thanks!
0 Kudos
Message 10 of 10
(3,281 Views)