Find commontimes

版本 1.0.0.0 (2.7 KB) 作者: M Sohrabinia
Finds common date-times from two or more date-time vectors with a given tolerance in seconds
191.0 次下载
更新时间 2013/6/6

查看许可证

This function is useful when two or more datasets with different time
periods are available, and the goal is to compare only the common records
which are available in all datasets. It needs AT LEAST 2 date vectors and
finds common times in those two (or more) vectors. Each time in times1
will be matched with all times in times2 vector with a tolerance given in
prec_sec (precision in seconds). The default value for prec_sec is 5
seconds. Additional time vectors can be given (handled by varargin).
If any time does not exist even in one dataset, it will be ignored in the output.

Inputs:
times1: first times vector numeric or string format
times2: 2nd times vector numeric or string format
prec_sec: precision level in comparing times in seconds
varargin: 1 to n additional time vectors
Outputs:
commontimes: string vector of common times in all input time vectors.
idxs: original indexes of matched records from all input time vectors;
this can be used to re-organize other data-fields of datasets based on
the corresponding time vectors of each dataset. For example, if first
timeVec is from dataset1, the first column in idxs matrix will be the
original indexes of matched records in dataset1. Similarly, the
second, 3rd, ... columns of idxs can be used to extract common records
of dataset 2, 3, ... .
dtAll: a matrix of all input time vectors in Matlab's numeric date
format (can be used to validate the results).
cmntNum: common times in Matlab's numerical date format

引用格式

M Sohrabinia (2024). Find commontimes (https://www.mathworks.com/matlabcentral/fileexchange/42118-find-commontimes), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2011b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Dates and Time 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0