Search code examples
matlabexport-to-excel

Export several matrices to excel in MATLAB


I want to write to an excel file n matrices, if I would like 2 to be in the same page, and other two on the same page, how to do it

I have

xlswrite('file.xls', matrix1, 'page1', 'A1');
xlswrite('file.xls', matrix2, 'page1', 'A50');

Is there a way to make dynamic the 4th parameter like

xlswrite('file.xls', matrix2, 'page1', 'A'%size(matrix));

Solution

  • You can try:

    xlswrite('file.xls', matrix2, 'page1', ['A' num2str(length(matrix2))]);
    

    Hope that helps.