|
Contents | Previous | Next | Subchapters |
| Syntax |
xlwrite(fileName, varName)file, varName, sheetName)file, varName, sheetName, xlsRange)
|
| See Also | xlread , xlsheets , read4 , bread |
xlwrite function copies data to Excel
starting in cell A1 of the current or specified work sheet.
The character row vector, xlsRange may be used
to specify an alternate location for the transferred data.
xlFile = "C:\temp\tst.xls"
rmfile(xlFile);
xlwrite(xlFile, rand(4,2))
O-Matrix will create a new Excel file that contains 4 rows
and 2 columns of numeric data starting in cell A1 of the
first sheet. If you continue the example above by entering
xlwrite(xlFile, seq(10), "MySheet")
O-Matrix will open the existing tst.xls file, create
a new work sheet named MySheet, and add 10 rows
of data starting in cell A1.
xlwrite(xlFile, identity(3), "MySheet", "D4:F6")
O-Matrix will open the tst.xls file and
add the 3 row by 3 column identity matrix to the MySheet
worksheet starting in row 4 of column 4.
xlFile = "c:\temp\chars.xls"
rmfile(xlFile);
xlwrite(xlFile, "Hello World")
O-Matrix will create a new Excel file that contains the string
"Hello World" in the first row of the first column in Sheet1.
Character range values are specified as a single cell
If you continue the example by entering
xlwrite(xlFile, "Greetings", "Characters", "B2")
O-Matrix will open the chars.xls file, create a new
worksheet named Characters and write the string
Greetings in the second row of the second column.