Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Determine whether a column in a Table contains time data

1 ビュー (過去 30 日間)
Aniruddha
Aniruddha 2017 年 2 月 2 日
終了済み: MATLAB Answer Bot 2021 年 8 月 20 日
How can I determine whether a column in a Table is a time vector? In addition, how can I ensure that all rows in this column have the same time series format?

回答 (1 件)

Iddo Weiner
Iddo Weiner 2017 年 2 月 2 日
Please define "time vector" - do you mean that the numbers should simply be monotonically increasing? or do you also have a certain "time format" / "time pattern" you're looking for ? If it's the first option, the solution is simple enough:
function out = is_monotonically_increasing(vector)
if sum (vector(2:end) - vector(1:end-1) <= 0) > 0
Out = 0;
else
Out = 1;
end
end
If you need something more specific please describe more thoroughly
  3 件のコメント
Iddo Weiner
Iddo Weiner 2017 年 2 月 4 日
Absolutely! Aniruddha - are you there? does this help? Or do you have different specifications?

Community Treasure Hunt

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

Start Hunting!

Translated by