Write VAXD and VAXG files in R2008b and later
MATLAB 7.7 (R2008b) and above do not support using FWRITE to write numeric data in VAXD and VAXG formats.
VAX architecture supports two methods for representing floating point double precision (64bit) numbers. These two methods are called VAXD and VAXG. Additionally, VAX supports a method called VAXF for representing single precision (32bit) floating point numbers. For detailed information on VAX encoding, please refer to: http://www.opengroup.org/onlinepubs/9629399/chap14.htm#tagfcjh_20
There are two options to patch your code:
Option A:
-----------
1. Open your file with the 'ieee-le' format instead of 'vaxd' or
'vaxg'.
2. Replace FWRITE commands with FWRITEVAX. Pass 'vaxd'
or 'vaxg' as an input argument.
For example, if your code originally looks like this:
fid = fopen(‘filename’, ‘w’, ‘vaxd’)
countA = fwrite(fid, varA, ‘single’)
countB = fwrite(fid, varB, 'double')
You would change your code to:
fid = fopen('vaxFileName', 'w', 'ieee-le')
countA = fwriteVAX(fid, varA, ‘single’)
countB = fwriteVAX(fid, varB, ‘double’, 'vaxd')
Option B:
-----------
1. Open your file with the 'ieee-le' format instead of 'vaxd' or
'vaxg'.
2. Replace FWRITE commands with FWRITEVAXD or
FWRITEVAXG.
For example, if your code originally looks like this:
fid = fopen(‘filename’, ‘w’, ‘vaxd’)
countA = fwrite(fid, varA, ‘single’)
countB = fwrite(fid, varB, 'double')
You would change your code to:
fid = fopen('vaxFileName', 'w', 'ieee-le')
countA = fwriteVAXD(fid, varA, ‘single’)
countB = fwriteVAXD(fid, varB, 'double')
Contains:
1. fwriteVAX.m: Call this function from your program to write to a binary file using VAX format.
2. fwriteVAXD.m Call this function from your program to write to a binary file using VAXD format.
3. fwriteVAXG.m Call this function from your program to write to a binary file using VAXG format.
4. VAXF_to_uint32le.m: To be called internally from fwriteVAX, fwriteVAXD and fwriteVAXG.
5. VAXD_to_uint64le.m: To be called internally from fwriteVAX, fwriteVAXD and fwriteVAXG.
6. VAXG_to_uint64le.m: To be called internally from fwriteVAX, fwriteVAXD and fwriteVAXG.
7. readme.pdf: This file.
Please see the following submission for reading data stored in VAX file format using MATLAB 7.7 (R2008b) and later releases:
Cite As
Aditya (2024). Write VAXD and VAXG files in R2008b and later (https://www.mathworks.com/matlabcentral/fileexchange/24793-write-vaxd-and-vaxg-files-in-r2008b-and-later), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.