%% Format Values with Extra or Missing Operators
% Format values when the number of columns in the data array is not equal to the number of operators. If A has more columns, then compose repeats formatSpec as an additional column of the output string array.
% Starting in R2017a, you can create strings using double quotes. Specify formatSpec as a string.

formatSpec = "The time is %d:%d";
A = [8 15 9 30;
     10 20 11 50];
str = compose(formatSpec,A)

%
% Format values when A has fewer columns.

formatSpec = "Check-in time %d:%d; Check-out time %d:%d";
A = [12 27;
     11 16];
str = compose(formatSpec,A)

% Since A has only two columns, compose uses only the first two formatting operators in formatSpec to format the values. compose leaves the other formatting operators unchanged.
% Copyright 2012 The MathWorks, Inc.