calendarDuration.char
calendarDuration: cmat = char (calD)
calendarDuration: cmat = char (calD, FMT)
Convert calendarDuration array to a character matrix.
cmat = char (calD) returns a character matrix with
one row per element in calD, taken in column-major order. The
second optional argument, FMT, can be used to specify the format of
the returned string representations of the calendarDuration input array
calD.
Rows shorter than the widest are padded on the left, so the character matrix is right-justified, as MATLAB returns it and as the array itself is displayed.
Source Code: calendarDuration
char converts the array into a character matrix of its display strings, one row per element. Rows shorter than the widest are padded on the LEFT, so the matrix comes out right-justified, the way the array itself is displayed.
d = calmonths ([1, 13])
d =
1x2 calendarDuration array
1mo 1y 1mo
char (d)
ans = 1mo 1y 1mo
A second argument renders the same array in another format, without altering it. Here the months are shown whole rather than split into years.
d = calmonths ([1, 13])
d =
1x2 calendarDuration array
1mo 1y 1mo
char (d, 'mdt')
ans = 1mo 13mo