# 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 array `X`. If `X` is a numeric array, then `Q` is a `calendarDuration` array with each element equal to the number of calendar quarters in the corresponding element of `X`. If `X` is a `calendarDuration` array, then `Q` is a `double` array with each element equal to the number of whole calendar quarters in the corresponding element of `X`.Q = fix(calmonths(t)/3) ```

## Examples

collapse all

```X = magic(4); Q = calquarters(X)```
```Q = 4x4 calendarDuration 16q 2q 3q 13q 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 2mo 8d 4mo 8d 6mo 8d ```
`Q = calquarters(X)`
```Q = 1×3 0 1 2 ```

## Input Arguments

collapse all

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