Method Reference: calendarDuration.cellstr

calendarDuration: cstr = cellstr (calD)
calendarDuration: cstr = cellstr (calD, FMT)

Convert calendarDuration array to a cell array of character vectors.

cstr = cellstr (calD) returns a cellstr array of character vectors, cstr, which has the same size as the input calD. cstr contains the string representations of the calendar durations in calD.

cstr = cellstr (calD, FMT) further specifies the format of the returned string representations. FMT must be a character vector conforming to the same specifications required by the constructor’s 'Format' property paired argument. Note that cellstr only accepts FMT as a single argument and not as a property paired argument.

Source Code: calendarDuration

Example: 1

cellstr converts the array into a cell array of its display strings.

 d = calmonths ([1, 13, 25])
d =
  1x3 calendarDuration array

    1mo    1y 1mo    2y 1mo
 cellstr (d)
ans =
  1x3 cell array

    {'1mo'}    {'1y 1mo'}    {'2y 1mo'}