Fast serialize/deseriali​ze

These functions can serialize most MATLAB data structures into a byte vector and vice versa.


Updated 26 Jan 2012

View License

This is an optimized rewrite of Tim Hutt's Serialize/Deserialize functions (it is up to 10x faster on arcane data structures) and supports a few additional data types.

Known limitations:
* Java objects cannot be serialized
* Arrays with more than 255 dimensions have their last dimensions clamped
* Handles to nested/scoped functions can only be deserialized when their parent functions
support the BCILAB argument reporting protocol (e.g., by using arg_define).
* New MATLAB objects need to be reasonably friendly to serialization; either they support
construction from a struct, or they support loadobj(struct), or all their important properties
can be set via set(obj,'name',value)

It has been tested relatively extensively but if you catch a bug, let me know!

Cite As

Christian Kothe (2023). Fast serialize/deserialize (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Serialize/Deserialize

Inspired: MATLAB over TCP/IP

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes

Included the improvements suggested by Moti Zilberman. Also corrected a bug involving sparse scalars (which could not be serialized before under some circumstances).