필터 지우기
필터 지우기

Converting dates from Excel Spreadsheet into MATLAB

조회 수: 3 (최근 30일)
Sarah
Sarah 2011년 10월 5일
Hey everyone,
I have a quick question. I am trying to convert date strings from an excel spreadsheet into MATLAB. For example, lets say I have the following:
A1 1/1/2000 12:00 %mm\dd\yyyy hh:mm
A2 1/2/2000 12:05
A3 1/3/2000 12:08
B1 5
B2 6
B3 8
How can I plot the numerical data in column B as the y axis and the date strings as the x axis? I know I use xlsread. I have something like:
[excelDates, Test] = xlsread('date.xlsx');
I know its a relatively simple question, but any help would be greatly appreciated (:
~Sarah~

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 10월 5일
What value do you get in excelDates after running that xlsread() command? You can plot the data directly and then use datetick('x').
[Value, Time] = xlsread('test.xls')
Time=datenum(Time);
plot(Time,Value);
datetick('x',0,'keepticks');
  댓글 수: 10
Fangjun Jiang
Fangjun Jiang 2011년 10월 7일
Delete all the cells below the third row, even though they look empty. Some cells may contain whitespace.
Sarah
Sarah 2011년 10월 7일
You were right! :O I deleted the empty cells, and I guess some of it had white space because they work after deleting! Thanks so much!!
I asked everything on a "conceptual level" so I could understand the basics. Now I will apply it to my real problem. Thanks again (:
Now

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

추가 답변 (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