Documentation

calquarters

Calendar duration in quarters

Syntax

Q = calquarters(X)

Description

example

Q = calquarters(X)returns an array representing calendar quarters equivalent to the values in arrayX.

  • IfXis a numeric array, thenQis acalendarDurationarray with each element equal to the number of calendar quarters in the corresponding element ofX.

  • IfXis acalendarDurationarray, thenQis adoublearray with each element equal to the number of whole calendar quarters in the corresponding element ofX.

    Q = fix(calmonths(t)/3)

Examples

collapse all

X = magic(4); Q = calquarters(X)
Q =4x4 calendarDuration array16 2 3 q 13问5q 11q 10q 8q 9q 7q 6q 12q 4q 14q 15q 1q

Create an array of calendar durations. Then, convert each value to the equivalent number of whole calendar quarters.

X = calmonths(2:2:6) + caldays(8)
X =1x3 calendarDuration array2mo 8d 4mo 8d 6mo 8d
Q = calquarters(X)
Q =0 1 2

Input Arguments

collapse all

Input array, specified as a numeric array, calendar duration array, or logical array. IfXis a numeric array, it must contain only integer values. That is, you cannot create fractional calendar units.

Extended Capabilities

Introduced in R2014b

Was this topic helpful?