Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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 array
   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 array
   2mo 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. If X is 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?