Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!g23g2000yqh.googlegroups.com!not-for-mail
From: Rune Allnor <allnor@tele.ntnu.no>
Newsgroups: comp.soft-sys.matlab
Subject: Re: decoding floating point binary data from an HP impedance analyzer
Date: Mon, 28 Sep 2009 12:41:16 -0700 (PDT)
Organization: http://groups.google.com
Lines: 28
Message-ID: <42a37d2d-781f-41c6-b525-bb803836eed8@g23g2000yqh.googlegroups.com>
References: <h5s610$fvr$1@fred.mathworks.com> <h5sg9m$4rk$1@fred.mathworks.com> 
	<h5sgkr$rsk$1@fred.mathworks.com> <h9gtuv$kmp$1@fred.mathworks.com> 
	<h9jt40$oid$1@fred.mathworks.com> <h9r207$m2p$1@fred.mathworks.com>
NNTP-Posting-Host: 77.17.117.97
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1254166876 27140 127.0.0.1 (28 Sep 2009 19:41:16 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 28 Sep 2009 19:41:16 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: g23g2000yqh.googlegroups.com; posting-host=77.17.117.97; 
	posting-account=VAp5gAkAAAAmkCze5hvZtMeedpZWNthI
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; 
	Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; 
	.NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:573463

On 28 Sep, 21:15, "Mikael Evander" <evan...@stanford.edu> wrote:
> Right. I'm connected to the instrument again and extracted some data. To start with what's working, I told the instrument to transfer the data in ascii format, read it with fscanf(g) and converted it using str2num. What you get then are the correct values and they look like this:

---

Does the instrument store the data internally? If so, can the same
data be exported several times at different formats?

If 'yes' export the data first on ASCII format, and then once
again as floating point format. Then post the ASCII printout
and the corresponding floating-point value as hex numbers:

1) Open the binary file using

fid = fopen(filename,'rb');

2) Read the first floating point binary value from the file,

fpv = fread(fid,[1,1],'float32');

3) Write the value on hex format:

fprintf('%bX'n',fpv)

Rune