Info
此问题已关闭。 请重新打开它进行编辑或回答。
Determine whether a column in a Table contains time data
1 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
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 个评论
Walter Roberson
2017-2-3
Or using built-in functions:
Out = issorted(vector);
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!