|
From: | Stefan Pofahl |
Subject: | Re: Read Binary file exported from LabView |
Date: | Tue, 2 Oct 2012 00:30:25 +0200 |
I was impatient and tried around, it seems that each data
set is seperated by a 16bit floating number with the value of "0",
the following gives a propper result, for each data set (row):
[val, count] = fread(fid, [1,1], "single",0 , "ieee-le");
val
[val2, count] = fread(fid, [8,1], "double",0 , "ieee-le");
val2'
[val, count] = fread(fid, [1,1], "single",0 , "ieee-le");
val
[val3, count] = fread(fid, [8,1], "double",0 , "ieee-le");
val3'
In my perception this can only be a workaround.
Attached I send you my binary file and a picture of my LabView code.
Regards,
stefan
***
2012/10/1 Stefan Pofahl <address@hidden>
Hi,
is there anyone who tried to read binary files exported by Labiew?
In my example LabView code I generate an array 2 rows x 8 columns
of 32-bit numbers and export it in the little-endian format:
0 1 2 3 4 5 6 7
0 11 22 33 44 55 66 77
Now I try to read the data. I tried several alternatives, but I'm lost. Any hints?
E.g. if I try the following:
> [val, count] = fread(fid, [8,Inf], "double",0 , "ieee-le");
The output is:
val =
0.00000 7.00000 77.00000
0.00000 0.00000 0.00000
1.00000 11.00000 0.00000
2.00000 22.00000 0.00000
3.00000 33.00000 0.00000
4.00000 44.00000 0.00000
5.00000 55.00000 0.00000
6.00000 66.00000 0.00000
If I try:
> [val, count] = fread(fid, [2,Inf], "double",0 , "ieee-le");
The result is much better (the matrix seems to be flipped):
val =
0.00000 1.00000 3.00000 5.00000 7.00000 11.00000 33.00000 55.00000 77.00000
0.00000 2.00000 4.00000 6.00000 0.00000 22.00000 44.00000 66.00000 0.00000
The following command:
> [val, count] = fread(fid, Inf, "8*double",0 , "ieee-le");
results in:
val =
0.00000
0.00000
1.00000
2.00000
3.00000
4.00000
5.00000
6.00000
7.00000
0.00000
11.00000
22.00000
33.00000
44.00000
55.00000
66.00000
77.00000
It seems, as if there is an extra 0 added at the beginning of each row.
It looks better now, but I don't know what the trick is?
Regards,
Stefan
--
Stefan Pofahl
Rue d'Entremonts 28
1400 Yverdon-les-Bains
--
Stefan Pofahl
Rue d'Entremonts 28
1400 Yverdon-les-Bains
[Prev in Thread] | Current Thread | [Next in Thread] |