MATLAB: How to load .mat files from a Hadoop filesystem

.mat filehdfsloadmatMATLAB

I have MAT-files on a Hadoop filesystem (i.e. HDFS). How can I use MATLAB to load these files?

Best Answer

MATLAB offers the "datastore" object to access remote data on systems like HDFS:
You can use the "fileDatastore" function to load MAT-files from HDFS, as shown:
% Create a fileDatastore for the MAT-file on HDFS.
ds = fileDatastore('hdfs://myserver/path_to_file.mat', 'ReadFcn', @load);
% Read the MAT-file into the workspace.
s = read(ds);
Additional information on "fileDatastore" and its arguments is available in the documentation: