- Read the Data: Use xlsread to import the data.
- Convert Text to Datetime: Use datetime to convert the text data into datetime objects.
- Extract Day Information: Use the day function to extract the day from the datetime objects.
extract date from cell of mixed types
조회 수: 5 (최근 30일)
이전 댓글 표시
[dom,txt11,raw11]=xlsread('datasheet.xls',9,'A:A'); yields [] for dom, cell for txt11 and for raw 11 the following is output 'Date' '01/06/2014' '02/06/2014' '05/06/2014' 'NaN' 'NaN' I wish to get the day information from the raw11 data. day(),month(), etc in excel are throwing garbage and I cant use their output to MATLAB.
댓글 수: 0
답변 (1개)
BhaTTa
2024년 11월 21일 4:22
Hey @Utsav, When you import data from Excel using xlsread in MATLAB, and the date information is stored as text, you need to convert these text representations into MATLAB's datetime format to extract the day, month, or other components. Here’s how you can do it:Steps to Extract Day Information
Please refer to below documentation on datetime and day.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!