How can I use 'textscan' to read data from Sheet2 of an Excel file?
조회 수: 12 (최근 30일)
이전 댓글 표시
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
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
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
2019년 1월 7일
Try
readtable( _______, 'DatetimeType', 'exceldatenum' );
See the documentation.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Text Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!