07-09-2012 06:53 AM
hi all,
I took a measurement from an anemometer by its original program. I attached the file below. I want to convert this file to the decimal file. I all know is the data in file are in hexadecimal and 16-byte. How can I convert this file to decimal one? I prepared something as I saw in this forum but it gives me just one number. I attached the vi below too.
07-09-2012 07:28 AM
Hi ,
Refer this,
Regards,
Bijay
07-09-2012 07:30 AM - edited 07-09-2012 07:31 AM
@newbieeng wrote:
hi all,
I took a measurement from an anemometer by its original program. I attached the file below. I want to convert this file to the decimal file. I all know is the data in file are in hexadecimal and 16-byte.
Do you mean 16-bit? Signed or unsigned?
For posted example: Reading the file as string and then converting to numbers is the wrong approach. It requires extra memory to create the strings and then to convert to numbers.
All you need is a single Read Binary File, with the appropriate data type set.

07-09-2012 07:38 AM - edited 07-09-2012 07:41 AM
Hi newbie,
it doesn't make sense to convert the filename to some other datatypes. You have to load the datafile first!
@Bijay: as the file is no spreadsheetfile it doesn't make sense to load it using ReadFromSpreadsheetFile!
You may try this:
The file seems to contain SGL values so I typecasted them. If that's not the case you use the U8 array to do your own computations...
Edit:
Using ReadBinaryfile is somewhat easier...
"the data in file are in hexadecimal and 16-byte."
The file isn't in hexadecimal, it's just binary. And what do you mean by "16-byte"???
07-09-2012 07:38 AM
@smercurio_fc wrote:
@newbieeng wrote:
hi all,
I took a measurement from an anemometer by its original program. I attached the file below. I want to convert this file to the decimal file. I all know is the data in file are in hexadecimal and 16-byte.
Do you mean 16-bit? Signed or unsigned?
For posted example: Reading the file as string and then converting to numbers is the wrong approach. It requires extra memory to create the strings and then to convert to numbers.
All you need is a single Read Binary File, with the appropriate data type set.
the data is 16-bit unsigned. I wrote 16-byte wrongly. sorry for that.
07-09-2012 07:41 AM
@newbieeng wrote:
the data is 16-bit unsigned. I wrote 16-byte wrongly. sorry for that.
Then simply change the data type from I16 to U16.
07-09-2012 07:41 AM
Hi,
Thanks for feedback GerdW.
Regards,
Bijay
07-09-2012 07:48 AM
@GerdW wrote:
Hi newbie,
it doesn't make sense to convert the filename to some other datatypes. You have to load the datafile first!
@Bijay: as the file is no spreadsheetfile it doesn't make sense to load it using ReadFromSpreadsheetFile!
You may try this:
The file seems to contain SGL values so I typecasted them. If that's not the case you use the U8 array to do your own computations...
Edit:
Using ReadBinaryfile is somewhat easier...
"the data in file are in hexadecimal and 16-byte."
The file isn't in hexadecimal, it's just binary. And what do you mean by "16-byte"???
I wrote it wrongly. It must be 16-bit. It must be in hexadecimal. The manual of the program that I took this data file says the output is in hexadecimal format.
07-09-2012 08:14 AM
smercurio's solution should work for you, just change the I16 into a U16.
Are you confused because the display is in decimal? You can change the display by right clicking on the indicator and check Visibile->Radix. You will see a 'd' show up on your indicator. You can can click on that and select Hex.
07-09-2012 08:22 AM
@GerdW wrote:
Hi newbie,
it doesn't make sense to convert the filename to some other datatypes. You have to load the datafile first!
@Bijay: as the file is no spreadsheetfile it doesn't make sense to load it using ReadFromSpreadsheetFile!
You may try this:
The file seems to contain SGL values so I typecasted them. If that's not the case you use the U8 array to do your own computations...
Edit:
Using ReadBinaryfile is somewhat easier...
"the data in file are in hexadecimal and 16-byte."
The file isn't in hexadecimal, it's just binary. And what do you mean by "16-byte"???
I tried your suggestion and find something what I really do not know what they are. I attached the results print screen. I will try the second solution.