Exporting EEMs from drEEM
I occasionally get asked how to export EEMs that were created or modified with drEEM to individual text files.
Here is some code that you could tweak according to needs.
Note that some operating systems expect forward slash (/) rather than backslash() when specifying file paths.
Exporting to csv format is faster than exporting to Excel format, and works on all operating systems.
%export a 3D EEM dataset to individual csv files
Xout=XcRU; %in this example, XcRU is the dataset to be exported
foldername='D:\mymatlab\mydrEEM\eemdata\correctedEEMs'; %the exported files will be saved in this folder
for i=1:Xout.nSample
filename=deblank(char(Xout.filelist{i}));
filename=filename(1:end-5); %this removes unwanted final characters from filename, e.g. .xslx'
eem_i=squeeze(Xout.X(i,:,:)); %3D dataset => 2D matrix
eem_i=[[NaN; Xout.Em] [Xout.Ex'; eem_i]]; % attach Ex and Em to the eem
csvwrite([foldername '\' filename '_corr.csv'],eem_i) %write the eem to a csv file
end