
623I/O Techniques
For MAT-le I/O in Java, consider using the open-source JMATIO library.
1766
Instead of using Java I/O, we might consider using low-level MEX C-code.* MATLAB’s
m-code I/O is closely modeled after the standard C I/O, helping make the transition from
m-code to C-code relatively painless. MATLAB includes a dedicated doc page on using C/
C++ I/O in MEX,
1767
with a couple of corresponding working examples.
†
Here is a simple
example (a multi-threaded version is also available
1768
):
% The original m-code
data = rand(1000); % 1000x1000 double values = ~8MB
fid = fopen('data.bin','w');
len = fwrite(fid,data,'double');
fclose(fid); ...