Write VAXD and VAXG files in R2008b and later

Version 1.3.0.1 (117 KB) by Aditya
These functions mimic the deprecated functionality of FWRITE for writing data in VAX file formats.
733 Downloads
Updated 1 Sep 2016

View License

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:

http://www.mathworks.com/matlabcentral/fileexchange/22675

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
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.3.0.1

Updated license

1.3.0.0

Added URL to the file submitted to read VAX files

1.2.0.0

Added trademarks

1.1.0.0

Updated the files

1.0.0.0