To write a table to a specific row and column of an excel file in Matlab, you can use the following code:
672 chars16 lines
This code first loads the data from an excel sheet into a table called dataTable
. It then creates a new table called newTable
with the data that you want to write to the excel sheet. The colIndex
and rowIndex
variables specify the column and row indices where the new table should be written. The writetable
function is called with the file path, sheet name, and range specified by the filePath
, mySheetName
, and [char('A' + colIndex - 1), num2str(rowIndex)]
arguments respectively. The char('A' + colIndex - 1)
expression generates the letter of the column based on the column index, and num2str(rowIndex)
generates the string of the row index. Together, they generate the range string where the new table should be written.
gistlibby LogSnag