Difficulty importing dates using readtable

1 回表示 (過去 30 日間)
Isabelle van Vuuren
Isabelle van Vuuren 2019 年 5 月 25 日
コメント済み: Jeremy Hughes 2019 年 5 月 26 日
I'm trying to read some dates into matlab to do arithmetic with. The excel looks like this
askForHelp.PNG
right now, I'm trying
uRiDdD = readtable('filename.xls', 'datetime','%{d-MMM-y}D,%f%f%f');
but I get the following error:
Error using readtable (line 197)
Expected input to match one of these values:
'text', 'datetime', 'exceldatenum'
The input, '%{d-MMM-y}D,%f%f%f', did not match any of the valid values.

採用された回答

dpb
dpb 2019 年 5 月 25 日
The file doesn't match the format string -- it has a numeric value followed by two dates and who knows what else afterwards and you told it there was one date followed by three floating point values. Clearly that won't work...should be no mystery there.
First, unless the file is huge, just let readtable operate on its own; you have unambiguous date formats, it should have no issues interpreting the input unless there are ambiguities elsewhere in the file.
  1 件のコメント
Jeremy Hughes
Jeremy Hughes 2019 年 5 月 26 日
Format also doesn't work with Spreadsheets, only text.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by