Skip to content

yida/msgpack-matlab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MessagePack for Matlab

based on msgpack-c (https://github.com/msgpack/msgpack-c)

install:

mex -O msgpack.cc -lmsgpack

API

Packer:

>> msg = msgpack('pack', var1, var2, ...)

Add raw flag at the end of pack will enable packing all numeric type as raw (uint8)

>> msg = msgpack('pack', var1, var2, ..., 'raw')

Unpacker:

>> obj = msgpack('unpack', msg) 

return numericArray or charArray or LogicalArray if data are numeric otherwise return Cell or Struct

Streaming unpacker:

>> objs = msgpack('unpacker', msg)

return Cell containing numericArray, charArray, Cell or Struct

#Issue

Since Matlab string is two-bytes (UTF16), following approach will not return correct string size

>> msgpack('unpack', msgpack('pack', 'hello'))
>> h e l l o

For correct string size, use

>> msg = msgpack('pack', uint8('hello'))
>> char(msgpack('unpack', msg))'
>> hello

About

MessagePack for Matlab

Resources

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE
Unknown
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •