How to send Java byte array to MATLAB matrix directly?

I have a Java GUI that takes video frames into an array of bytes and saves them directly to the original output file. I can then load this file into MATLAB and execute my signal processing algorithm. However, the source file ends in approximately 1 GB and takes a very long time to open it in MATLAB.

I am currently using Process inside SwingWorker to run a MATLAB instance and the algorithm executes and generates the results. All this works correctly, but loading a raw 1 GB file into MATLAB is very slow, on the order of 30 seconds.

I am wondering, is there anyway the ability to directly pass an array of Java bytes to MATLAB?

Thanks in advance!

+4
source share
1 answer

Matlab launches its own Java virtual machine, so you can call Java classes from the inside and get Java objects returned from java class invocation methods . In this case, your byte array will be translated directly to the uint8 array.

Depending on the JVM and the limitations of interacting with a Java program, this may be the easiest way to transfer data.

+2
source

All Articles