%% Append Data to Spreadsheet
% Append an array of data below existing data in a spreadsheet.
% Create two matrices in the workspace.

M1 = magic(5)
M2 = [5 10 15 20 25; 30 35 40 45 50]

% Write the matrix M1 to a spreadsheet file, M.xls.

writematrix(M1,'M.xls')

% Append the data in matrix M2 below the existing data in the spreadsheet file.

writematrix(M2,'M.xls','WriteMode','append')

% Read the spreadsheet file and display the matrix.

readmatrix('M.xls')

% Copyright 2019 The MathWorks, Inc.