Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - Français


isregular

check if the time vector is regular

Syntax

t = isregular(x)
t = isregular(x, timeUnit)
[t, step] = isregular(x)
[t, step] = isregular(x, timeUnit)

Arguments

x

duration, datetime or timeseries

timeUnit

string with possible values "years", "months", "days" or "time" (default value)

t

boolean

step

time step regular (%nan if x is not regular)

Description

The isregular function checks if the time vector contains values with fixed time step.

isregular(x) returns %t if x is a duration or datetime vector with regular time step.

isregular(x, timeUnit) returns %t if x has a regular time step according to TimeUnit. Be careful, a datetime vector whose time step is a month will not be regular because the number of days differs between the months. To check that this vector is regular in months, use "months" as timeUnit: isregular(x, "months").

The step argument contains the time step when x is regular.

Examples

With duration

d = hours(0:2:10);
[a, b] = isregular(d)

With datetime

dt = datetime(2000, 1, 1): calmonths(2): datetime(2001, 1, 1);
[a, b] = isregular(dt)
[a, b] = isregular(dt, "months")

With timeseries

Time = duration(0,0:10, 0)';
Temperature = [38 37.5 37.4 37.5 37.1 37.6 37.7 38.2 37.8 37 38.3]';
ts = timeseries(Time, Temperature, "VariableNames", ["Time", "Temp"]);
[a, b] = isregular(ts)

See also

  • duration — create a duration - duration in hours, minutes and seconds
  • datetime — create points in time
  • timeseries — create a timeseries - table with time as index

History

VersionDescription
2024.0.0 Introduction in Scilab.
Report an issue
<< groupsummary Timeseries/Table matrix2table >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:16:04 CEST 2024