Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!cyclone1.gnilink.net!spamkiller.gnilink.net!gnilink.net!nwrddc02.gnilink.net.POSTED!702e7bde!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: fopen(machineformat=vaxd) Message-ID: <chlmf41e2l8a50m19tu48q9lh5706amkvp@4ax.com> References: <gdcld5$2jj$1@fred.mathworks.com> <gdd73e$71t$1@fred.mathworks.com> <gddq4p$k2t$1@fred.mathworks.com> X-Newsreader: Forte Agent 3.3/32.846 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 50 Date: Sun, 19 Oct 2008 15:59:47 GMT NNTP-Posting-Host: 71.112.96.193 X-Complaints-To: abuse@verizon.net X-Trace: nwrddc02.gnilink.net 1224431987 71.112.96.193 (Sun, 19 Oct 2008 11:59:47 EDT) NNTP-Posting-Date: Sun, 19 Oct 2008 11:59:47 EDT X-Original-Bytes: 3439 Xref: news.mathworks.com comp.soft-sys.matlab:496070 On Sat, 18 Oct 2008 23:06:01 +0000 (UTC), "Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote: >Thanks James! > >> I may be able to write some custom code for you ... I just did something similar on another newsgroup thread recently. Is the file just a pure binary file with only D-FLOAT numbers? How many per record? What system are you reading these on? Do you know if your system is big-endian or little-endian? > >It would be a big hack! I don't think so. At least not based on what you have written so far. >I'm working with C3D files, which contain a section with mixed CHAR, INT8, UINT16, FLOAT32. >Afterwards a big block of binary records is following and finally **any** kind of supplemental data are allowed. > I am assuming you can still open and read the files, and most of the data (i.e., the CHAR, INT8, etc.) still reads in OK as long as you get the endian stuff correct. It sounds like your only real problem is the VAXD floating point format. My strategy would be to simply read these values in as double, int64, or uint64 bit patterns, and then write a little conversion function. I notice you have FLOAT32 above. This would be a single precision F_FLOAT format, not a double precision D_FLOAT format. Are you reading in single precision 32-bit floating point numbers, or double precision 64-bit floating point numbers? F_FLOAT numbers are actually easy to convert to IEEE single once you get the endian correct ... just divide what you read in by 4. >I have about trial 20.000 files and assume 20% of them use the VaxD format. > >I'm enormously surprised that Matlab has removed this important feature from FOPEN! It worked since Matlab 4 (or even earlier), you find the VAXD-Format in Octave and Scilab. Curious. Why would they delete a capability? I don't know. > Unfortunately, I cannot find any documentation for this loss of features on the Mathworks web docs. By the way, where do I find the documentation for former releases? > I don't believe The Mathworks has any documentation online for former releases, unfortunately. >So the best solution for me would be a conversion in 6.5.1: Read in VAXD and develop a function to write in little-endian. That's no fun. > Actually, the endian stuff is easy ... just do some byte swapping. It is the conversion of VAXD (8 bit exponent, 55 bit mantissa) to IEEE double (11 bit exponent, 52 bit mantissa) that is a bit tricky (mostly the rounding), but I don't think it would be too difficult. James Tursa