%% Append Matrix Data to Text File
% Append an array of data below existing data in a text file.
% Create two matrices in the workspace.

fibonacci1 = [1 1 2 3; 5 8 13 21; 34 55 89 144]
fibonacci2 = [233 377 610 987]

% Write the matrix fibonacci1 to a text file, fibonacci.txt.

writematrix(fibonacci1,'fibonacci.txt')

% Append the data in fibonacci2 below the existing data in the text file.

writematrix(fibonacci2,'fibonacci.txt','WriteMode','append')

% Read the text file and display the matrix.

readmatrix('fibonacci.txt')

% Copyright 2019 The MathWorks, Inc.