DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

How to keep same format for numeric variable?

I need the numeric variable to maintain the same format irrespective of the values.

 

e.g   If  I select XX.XXX

then 2.345  should  be saved as  02.345

         23.34  should be saved as  23.340

        2             as                           02.000

       1.23     as                               01.230

 

This way the total number  of charcters   in a set of numeric varaoiables remain the same irrespective of actual values.

 

0 Kudos
Message 1 of 7
(7,917 Views)

How and where are you using the variable?

 

If you are using it for RS232 output, then the format [az7.3] should work. 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 2 of 7
(7,914 Views)

The application is gathering wind parameters as variables and sending all the variables as a single packet .

eg: wind speed  in format xx.xx and wind direction in xxx.xx format

Then data like 13.40, 123.34  would   be sent as 13.4 ,123.34 where as it is needed at the other end as  13.40, 123.34

                          5.60, 23.34    would be sent as    5.6, 23.34   where as it is needed at the other end as   05.60, 023.34

In short a field length of five  for wind speed and six for wind direction ( incl decimal point) irrespective of actual values.

how to maintain the leading zeroes ?

I hope I have conveyed my problem....

0 Kudos
Message 3 of 7
(7,889 Views)

What module are you talking about?

 

If you need to SEND a string, via the RS232 Output, then, you can use the Global Strings, Extended settings, to create a formula that will combine and format the numeric values. Because you need the leading zeros, you need to use some decision making in the formula.

 

For example, this Extended formula will create the string you mention:

 

strsel(${VAR_1}<10.000, "0","") + strfmt(${VAR_1},7,2) + ", " +  strsel(${VAR_2}<100.000, "0","")  + strsel(${VAR_2}<10.000, "0","") + strfmt(${VAR_2},7,2)

Allowed me to format this string

00.95, 036.57

 

 

 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 4 of 7
(7,886 Views)

My sincere thanks..............

A  different  but effective approach has been suggested here  to circumvent the lacunae in DASYLab. I will definitely try this

My only apprehension is that I have about 42 variables which are converetd as a string  and sent through COM port. I need to add decision making for all.  In addition to the leading zeroes my data has to maintain the zeroes which come at the end also

like

005.60 for 5.6      

034.23 for 34.23

000.80 for 0.8

 

All the same, my sincere thanks

 

0 Kudos
Message 5 of 7
(7,876 Views)

Hi,

 

If you are using labview, then just convert the number to string. Then you would have to do a bit of coding to convert it to the desired format.

 

 hope your issue is resolved.

 

vaibhav

.......^___________________^
....../ '---_BOT ____________ ]
...../_==O;;;;;;;;_______.:/
.....),---.(_(____)/.....
....// (..) ),----/....
...//____//......
..//____//......
.//____//......
..-------
0 Kudos
Message 6 of 7
(7,870 Views)

You can try a multiple channel RS232 Output, where each channel is configured to format the data correctly

 

Chan 0: [az7.2],

Chan 1: [az5.2]\r

 

 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 7 of 7
(7,864 Views)