help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Read Binary file exported from LabView


From: Stefan Pofahl
Subject: Read Binary file exported from LabView
Date: Mon, 1 Oct 2012 19:35:11 +0200

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]