Problem converting a cell array of integers to datetime
6 ビュー (過去 30 日間)
古いコメントを表示
Hi, I have an array if integers (100x1 cell), like 736696, 736697, ....
I try to use b = datetime(a, 'ConvertFrom', 'datenum'), but keep getting error "Input data must be a numeric or a cell array or char matrix containing date/time strings." Why?
Thanks
0 件のコメント
採用された回答
Jan
2017 年 2 月 1 日
編集済み: Jan
2017 年 2 月 1 日
If your data is really stored in a cell:
a = {736696, 736697};
v = [a{:}]; % Converted to vector
b = datetime(a, 'ConvertFrom', 'datenum')
Many functions of Matlab expect numeric values in a numeric array and not as a cell. Cells are useful to store elements of different size or type.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Calendar についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!