Integer Variables?
| Mweigand | April 22, 2008 - 14:41 | ||
|---|---|---|---|
|
Hello! I have to import a binary file from a custom experiment. This uses packed bits to store 2 values in an unsigned long(32bit) int. |
|||
| Mweigand | April 22, 2008 - 14:41 | ||
|---|---|---|---|
|
Hello! I have to import a binary file from a custom experiment. This uses packed bits to store 2 values in an unsigned long(32bit) int. |
|||
Joined: 2007-03-01
Location: United States
Igor variables are strictly doubles. However, a wave's type can be integer (long or short, unsigned or signed). You'll probably want to just create a wave with as many points as you have integer variables. If necessary you can use dimension labels to refer to different points of the wave by a name. Try looking in the command help for the Make operation and the SetDimLabel operation and go from there.
Joined: 2007-06-21
Location: United States
You don't say how you are loading the data but I suspect you are using FBinRead. You can tell FBinRead that you are reading unsigned long using the /U/F=3 flags. This will read an unsigned long into the variable you pass as the last parameter to FBinRead and will convert the unsigned long to double. You can then break the two values apart with something like:
Variable lowPart = value & 0xFFFF
Variable highPart = value / 2^16