How can I use 'textscan' to read data from Sheet2 of an Excel file?

12 ビュー (過去 30 日間)
Tahir Ameen
Tahir Ameen 2019 年 1 月 6 日
編集済み: per isakson 2019 年 1 月 7 日
As said in question, want to know if textscan can be used to scan data from Sheet2 of an Excel file?
Thanks for any help.
  8 件のコメント
Jan
Jan 2019 年 1 月 7 日
@Tahir Ameen: CSV files do not have sheets. A CSV file is a text file and there is no way to define something like a sheet in it. Then neither textscan cannot have the power to select a sheet. Sheets are properties of binary XLS and XLSX files. There is no way to use a tool written to import text files of a certain format to import binary files on another format.
Summary: textscan imports text files only and text files do not have sheets. If you need to import sheets, use readtable or xlsread.
Now you reveal, that you are struggeling with dates. Of course this can be solved directly without the need of the time-consuming indirection over CSV files. Please post the current code and an example file. Then it is possible to suggest a solution.
per isakson
per isakson 2019 年 1 月 7 日
編集済み: per isakson 2019 年 1 月 7 日
Caveat: Personally I try to avoid Excel. What looks like datetime in Excel may be a character string or "datenum of Excel" presented as datetime. xlsread reads the first as a character string and the latter as a "strange number".

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

採用された回答

per isakson
per isakson 2019 年 1 月 7 日
Try
readtable( _______, 'DatetimeType', 'exceldatenum' );
See the documentation.

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by