How to use matlab xlswrite

Take matrix A=[1, 2, 3, 4;5, 6, 7, 8] as an example for introduction
Case 1:
Enter data into the specified EXCEL, without specifying the workbook or cell location
Enter xlswrite(‘1.xlsx’,A) in the MATLAB main window and press enter and we will see in excel 1.xlsx and sheet1 as follows

Note: 1 If you put Sheet2 before Sheet1, the data will be written to Sheet2.
2 When this command is executed, the Excel being written should be in the closed state.
Example 2:
Type xlswrite(‘1.xlsx’,A,2) in the main window into the specified sheet without specifying A cell, and press enter

We are putting A matrix in the second sheet. And we need to be careful because we are in sheet3 and not Sheet2.

    example 3 write the data to the specified sheet, specify the location, enter xlswrite(‘1.xlsx’,A,3,’C5′) in the main window of MATLAB, enter

We will see in Sheet2 in the third position that matrix A was written from c5 cell. We could also have written xlswrite(‘1.xlsx’,A,3,’ c5 :F6′). Same result, but the former is simpler and more convenient.


Read More: