01-05-2016 05:37 AM
Hello,
I have some Hex datas( starting from 0x63C, 0x199, 0x21F, 0x19F etc) with space in between, and want to import these datas into the array( int Data[512] ) I created.
I was using
FileToArray (LoadFilePath, Data, VAL_SHORT_INTEGER, 512, 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_BINARY);
But the data I am getting in Data[] is Data[0] = 0x3336, Data[1] = 0x2C43, Data[2] = 0x0A0D, Data[3] = 0x3931.
Is it because I didn't use the Function in the right way?
Thanks,
01-05-2016 05:30 PM
It seems to me that your data is not stored in binary format but as a string with comma+CR+LF separators instead. You may have looked at the data with an editor that renders CRLF with a space, and possibly adds 0x' characters which are not present in output data.
The value resulting from FileToArray function are the result of this organization:
36: hex code for character '6'
33: the same for '3'
43: the same for 'C'
2C: hex code for comma
0D0A: CRLF separator
39: character '9'
31: character '1'
A binary file would not have separators inside: numbers are simply stored consecutively each occupying the exact number of bytes given from variable type (2 bytes for shorts, 4 bytes for 32bit integers...)
If my assumption is correct, FileToArray is not the best option to read data back: sscanf () or Scan () appear a better solution.
02-09-2016 12:24 PM
How read data file excel and show result in table under labwindows??????
02-09-2016 04:45 PM
Duplicated post: see here