Serialize/Deseriali​ze

Version 1.1.0.0 (3,31 ko) par Tim
Encode and decode almost any matlab variable into a sequence of bytes.
2,1K téléchargements
Mise à jour 16 déc. 2010

Afficher la licence

This pair of functions can serialize and deserialize (i.e. encode and decode) almost any matlab object into a sequence of bytes. This will be useful for saving objects to disk, sending them over the network, or perhaps to other programs.

Any combination of structs, cells and matrices are supported. All the data types (i.e. all integer sizes, chars, bools, singles and doubles) are supported. They are automatically converted back to double on decoding, but you can easily change this.

I haven't tested it extensively, but it's quite short so any bugs should be easy to fix.

Usage is like this:

astruct.field1 = [1 2 3]; astruct.field2 = {'foo', 'bar', 'baz'};
serialized_astruct = serialize(astruct);
deserialized_astruct = deserialize(serialized_astruct);

After execution, astruct and deserialized_astruct should be equal.

Citation pour cette source

Tim (2024). Serialize/Deserialize (https://www.mathworks.com/matlabcentral/fileexchange/29457-serialize-deserialize), MATLAB Central File Exchange. Extrait(e) le .

Compatibilité avec les versions de MATLAB
Créé avec R2010b
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Data Type Conversion dans Help Center et MATLAB Answers
Remerciements

Inspiré par : serialize

A inspiré : DataHash, Fast serialize/deserialize

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
1.1.0.0

Fix bug with single numbers.

1.0.0.0