%% Capture Matrices as Strings
%
% Create a 3-by-3 diagonal matrix.

I = diag([1 1 1]);

%
% Use formattedDisplayText to capture the matrix as a string.

strI = formattedDisplayText(I)

%
% You can also use expressions as inputs.

strIplus = formattedDisplayText(2*I + ones(3))

%
% Copyright 2020 The MathWorks, Inc.