Write data on to Excel
4 views (last 30 days)
I want to write the following data onto excel, in a way which the first answer (M(: , : , 1)) will be at the range E to G and the next answer (M(: , : , 2)) will be at the range I to K, so 4 column space between each.The sample data is below, is there a easier to do this as sometimes there might be more than 6 data sets.
X = ones(6).*(1:6);
Y = 2*ones(6).*(1:6);
Z = 3*ones(6).*(1:6);
M = permute(cat(3,X,Y,Z), [1 3 2]);
M= reshape(M, 6, );
Guillaume on 6 Apr 2020
If I understood correctly:
xlswrite(somefile, reshape([M, nan(size(M, 1), 1, size(M, 3))], 6, ), '', 'E1')
basically pad your 3D matrix with a column of NaNs. NaNs result in empty cells in the output spreadsheet.