No BSD License  

Highlights from
u8rw

4.5

4.5 | 2 ratings Rate this file 2 Downloads (last 30 days) File Size: 115.75 KB File ID: #352

u8rw

by Tom Davis

 

13 Mar 2000 (Updated 21 May 2003)

Translate between raw binary data and MATLAB matrices.

| Watch this File

File Information
Description

U8READ and U8WRITE are similar to the built-in functions FREAD and FWRITE except that they transfer data from and to a MATLAB uint8 matrix instead of a file.

A format (precision) argument controls the translation between MATLAB variables and the bytes stored in the uint8 matrix. Mixed precisions within a single call are supported. Big or little endian byte ordering can be specified.

These files are useful for formatting data for external devices (e.g. GPIB and serial ports) and for translating complex binary files (e.g. digital maps).

MEX-files for MacOS, MacOS X and PCWin are included plus source.

MATLAB release MATLAB 5.2 (R10)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
29 Jan 2004 Jim Hunziker

This was just what I was looking for when reading an array of big endian doubles from a DLL in Windows. It worked great!

16 Jun 2006 Tim Largy

This tool performs misaligned memory accesses. Some systems allow this (e.g. Windows on x86) but other systems don?t; instead the program will crash. To get around this problem you?ll have to tell your compiler and linker to allow misaligned memory accesses. For example, when using the Sun C compiler on a modern SPARC-based system you must use the -xmemalign flag. Consult your compiler documentation then modify your mexopts.sh file to include the proper compiler and linker flags.

I applaud the author of this tool for including a test program. MATLAB has changed since this tool was written and the test program contains MATLAB calls that don?t exist in MATLAB 7. Fortunately they are related to displaying graphs and can be commented out.

12 Nov 2008 William Slater

This is almost exactly what I was looking for. Two suggestions would have made it perfect.

1) Support to read VAX F_float, D_float, and G_float
2) Ability to write the decoded bytes into a structure to preserve data types of embedded data fields

Otherwise, a very beneficial piece of code.

Please login to add a comment or rating.
Updates

desc

21 May 2003

Changed name (was WinU8); added source code; improved memory allocation algorithm; added binaries for Mac.

Tag Activity for this File
Tag Applied By Date/Time
data import Tom Davis 22 Oct 2008 06:37:01
data export Tom Davis 22 Oct 2008 06:37:01
translate Tom Davis 22 Oct 2008 06:37:01
binary Tom Davis 22 Oct 2008 06:37:01
endian Tom Davis 22 Oct 2008 06:37:01
format Tom Davis 22 Oct 2008 06:37:01
precision Tom Davis 22 Oct 2008 06:37:01

Contact us at files@mathworks.com