# Best way to use google protocol buffer (protobuf) with Matlab

I am trying to import some protobuffs into Matlab. I see 2 ways to do this

1) Use the protobuf Matlab Plugin

2) Use the C ++ APIs provided by Google and then import the data into Matlab using mex files.

Since I am working with large scale data, which one is faster to run?

source to share

Faster startup is probably C ++, of the two.

I can tell you for sure that the transition to the Matlab language level for bytes, double-byte, four-byte reads or buffer calls is much slower than you might expect.

And looking in protobuf-matlab / source / browse / protobuflib I can see tons of operations of this type performed in Matlab code.

You haven't pointed out which I think is the best of both worlds: the Java API.

If you have any Java code in your project or a modest level of comfort with Java, I would strongly consider using the Java API. Matlab has really good Java compatibility; it has the big advantage that you can interactively work with example methods () etc. There is some learning curve with javaObject () / javaMethod () where you can use more custom syntax.

source to share