필터 지우기
필터 지우기

XLS file with a date column, the date column cannot be read correctly with MATLAB 2016a in os x (10.11.5)

조회 수: 1 (최근 30일)
I have a Excel file with a date column, the date column can be read correctly with Numbers in os x (10.11.5) . However, when I open the file with 2016a, the date column is change to be 5 consecutive digits, it supposed to be mm/dd/yy. Please advise how to resolve the problem.
REMARK
=================
I open the file with MATLAB 2016a(double click with filename in MATLAB) and I did't call any command in the window.
Please refer the Excel file (the author name for documents, Dr. E.P.Chan) https://github.com/burakbayramli/kod/blob/master/books/Quantitative_Trading_Chan/IGE.xls

채택된 답변

Walter Roberson
Walter Roberson 2016년 6월 1일
t = readtable('IGE.xls');
t.Date = datetime(t.Date, 'ConvertFrom', 'excel', 'Format', 'MM/dd/yy');
  댓글 수: 3
Walter Roberson
Walter Roberson 2016년 6월 1일
You do not need datenum, datestr, or x2mdate() if you have R2014b or later.
t = readtable('IGE.xls');
t.Date = char( datetime(t.Date, 'ConvertFrom', 'excel', 'Format', 'yyyyMMdd') );
Nelson Mok
Nelson Mok 2016년 6월 2일
Dear Walter, According to your suggestions, I did the code-fixing. Thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by