| Excel Link | ![]() |
Create or append MATLAB matrix with data from Excel worksheet
Syntax
Description
Appends data in mdat to MATLAB matrix var_name. Creates var_name if it does not exist. The function checks the dimensions of var_name and mdat to determine how to append mdat to var_name. If the dimensions allow appending mdat as either new rows or new columns, it appends mdat to var_name as new rows. The function returns an error if the dimensions do not match. mdat must contain either numeric data or string data. Data types cannot be combined within the range specified in mdat. Empty mdat cells become MATLAB matrix elements containing zero if the data is numeric and empty strings if the data is a string.
Examples
appends the data in cell range A1:A2 to the MATLAB matrix B. B is now a 2-by-3 matrix with the data from A1:A2 in the third column.
| A1 |
||
| A2 |
B is a 2-by-2 MATLAB matrix. Cell C1 contains the label (string) B, and new_data is the name of the cell range A1:B2.
appends the data in cell range A1:B2 to B. B is now a 4-by-2 matrix with the data from A1:B2 in the last two rows.
| A1 |
B1 |
| A2 |
B2 |
See Also
| matlabsub | MLAutoStart | ![]() |