Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: decoding floating point binary data from an HP impedance analyzer
Date: Tue, 11 Aug 2009 16:25:04 +0000 (UTC)
Organization: Stanford University
Lines: 22
Message-ID: <h5s610$fvr$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1250007904 16379 172.30.248.35 (11 Aug 2009 16:25:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 11 Aug 2009 16:25:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1805038
Xref: news.mathworks.com comp.soft-sys.matlab:562443

Hi.

I'm currently working with GPIB control of an old HP 4194 impedance analyzer using matlab. I've worked with it for a while using the ascii file format for data transfer and everything works fine. The problem is that I would need to move to the 32 bit floating point format to improve my data transfer rate. The impedance analyzer claims to use the IEEE 728-1982 standard which isn't really standard anymore if I understood things right. 

If I do an fread(g,'float32') command to read the data, I get properly formatted data but the numbers are way off. Instead of giving me an impedance around tens of kilo ohms I get a vector of 1e38 something. I'm obviously not telling matlab how the read this data correctly but I haven't been able to find any way to format it. 

My interpretation is that since I actually get properly formatted data, everything except for the data block is read correctly by matlab. According to the HP manual, the data block is structured as follows:

SEEEEEEE EMFFFFFF FFFFFFFF FFFFFFFL
S - sign bit
E - exponent bit
M - most significant bit of the fractional part
F - an intermediate fractional bit
L - least significant fractionl bit

So using this information I should be able to read the data if I had the pure binary form of my data stream but I can't even get that. 

Any suggestions on what I should try next or ways to get matlabs float interpretation to make more sense?

Thanks in advance and best regards

Mikael