03-04-2009 09:01 PM
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.
03-05-2009 06:17 AM
How and where are you using the variable?
If you are using it for RS232 output, then the format [az7.3] should work.
03-08-2009 10:52 PM
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....
03-09-2009 08:19 AM
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
03-09-2009 11:48 PM
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
03-10-2009 01:11 AM
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
03-10-2009 11:10 AM
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