Converting VAX float to Matlab float

Hello,
I am working on a script that needs to read in a binary file containing VAX floats/doubles. Matlab used to have a machine format for FOPEN to cover that kind of conversion, but it is no longer supported.
Is there any workaround or replacement? I checked the docs for VAX/VMS, but came up with nothing :(
Thanks.

답변 (2개)

Fangjun Jiang
Fangjun Jiang 2011년 8월 17일

0 개 추천

what do you mean, I saw fopen() has the option for 'vaxd'.
All right,
fopen No Longer Supports VAXD, VAXG, and Cray Machine Formats
Calls to fopen with any of the following values for machine format return an error:
* 'vaxd' or 'd'
* 'vaxg' or 'g'
* 'cray' or 'c'
Compatibility Considerations
In previous releases, calls to fopen with machine format values associated with VAXD, VAXG, and Cray did not result in an error.
To read files in VAXD and VAXG formats, consider the workaround available on the MATLAB Central File Exchange, file ID #22675.

댓글 수: 1

Thom
Thom 2011년 8월 17일
Please reread my post. The 'vaxd' format appears to be deprecated in R2008 (and imagine all subsequent versions, unless it was added back in).

댓글을 달려면 로그인하십시오.

Jan
Jan 2011년 8월 17일

0 개 추천

Yes, MATLAB has suddenly dropped the VAXD support. See CSSM: 18 Oct 2008.
There are some solutions in the FEX:
Please test them exhaustively, because there have been some serious bugs in the past. I think the most efficient method would be to read the files by another programming language and convert them to IEEE format.
Please write an enhancement request to TMW if you are suffering from this strange limitation also. Perhaps the VAXD support will be back again, if enough people need this feature.
See also my VAXD related answer in http://www.mathworks.com/matlabcentral/answers/1427-what-frustrates-you-about-matlab. I'm looking forward to James' submission.

댓글 수: 2

James Tursa
James Tursa 2011년 8월 17일
Yikes! I am embarassed to admit that I forgot all about this because I have been currently working on updates to my MTIMESX submission (in-place operations, matrix versions of prod and cumprod) and Fortran 95 Interface submission (64-bit support and a few enhancements).
For the VAXD and VAXG stuff, basically I have overloaded fopen, fclose, fread, and fwrite routines that look for VAXD, VAXG, etc arguments, pick them off and tag the file as VAXD (or VAXG) then pass all the other arguments through to the builtin fopen etc routines. Then whenever you call fread or fwrite for a VAXD or VAXG tagged file they automatically convert the bit patterns for you in the background. Bottom Line: All of your old code that uses VAXD or VAXG options will work without modification in newer versions of MATLAB that have no native VAXD or VAXG support. I have working prototype code for all of this at the moment. I will bump up the priority of this project, polish it up, and try to get an FEX submission out in a few weeks.
Beware of the current online workaround submissions for VAXD and VAXG support, they have bugs that have never been fixed to my knowledge (and they are really messy to use IMO).
Jan
Jan 2011년 8월 17일
@James: When TMW removed the VAX features from FOPEN, a lot of expensive testing must have been necessary. Now you spend time (== money) to make this feature available again. This is such inefficient, that it causes wild emotions in my mind - SUBOPTIMAL!

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Parallel Computing에 대해 자세히 알아보기

태그

질문:

2011년 8월 17일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by