image thumbnail

xxd (hexdump)

version (3.39 KB) by Boris Schauerte
xxd provides a data export interface to C/C++ headers by generating a static C/C++ array definition


Updated 29 Oct 2013

View License

A simple example says more than a lengthy description ...

>> data = uint8(rand(4,5,6)*255);
>> xxd(data,'foo');
unsigned char foo[] = {
0x5E, 0x35, 0x16, 0xC5, 0x34, 0x63, 0x8D, 0x3A, 0xA4, 0x7C, 0x27, 0xC7,
0x1A, 0x4B, 0x3D, 0x87, 0x17, 0x67, 0x1B, 0x1D, 0xC8, 0x4A, 0x9A, 0xF6,
0x6E, 0xB1, 0xC1, 0x6E, 0xA7, 0x1C, 0xEE, 0x30, 0x44, 0xCB, 0x7C, 0xC4,
0x65, 0x46, 0x09, 0xAC, 0x6E, 0x73, 0x9C, 0x0F, 0x51, 0xC5, 0xB2, 0x20,
0x21, 0x18, 0x02, 0x6C, 0xA7, 0xB8, 0x87, 0x1C, 0xA1, 0x20, 0x22, 0x19,
0x24, 0x2B, 0x32, 0x51, 0x51, 0x37, 0x40, 0xE4, 0xB3, 0x8E, 0x2F, 0x36,
0x14, 0xE9, 0xB4, 0x8E, 0x50, 0x2A, 0x9F, 0xFC, 0x2B, 0x42, 0x65, 0x13,
0xAE, 0x67, 0xFB, 0x67, 0x9E, 0x27, 0x61, 0x29, 0xC1, 0xDE, 0x59, 0xAF,
0x4B, 0x87, 0xD4, 0x98, 0x56, 0x4C, 0x73, 0x6C, 0x5C, 0x8E, 0xBD, 0x6C,
0x6D, 0x20, 0x06, 0x4A, 0x51, 0xA7, 0xF4, 0xEF, 0x75, 0x3D, 0xC3, 0xC2
unsigned int foo_len = 120;
unsigned int foo_ndims = 3;
unsigned int foo_size[] = {4,5,6};

Cite As

Boris Schauerte (2021). xxd (hexdump) (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2013a
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!