How do I get matlab to recognize a date in a .txt file?
이전 댓글 표시
I have a .txt file with two columns, the first with dates in the format yyyy-mm-dd and the second with prices such as '42.23'. However, when I load the .txt file into matlab it only recognizes the year.
load data.txt
>> data(1,1)
ans =
2005
or
>> data(1,:)
ans =
1.0e+03 *
2.0050 0.0422
I need matlab to see the entire date for plotting purposes. Does anyone know how I can fix this?
채택된 답변
추가 답변 (1개)
Peter Perkins
2015년 11월 19일
0 개 추천
You may fnid that using readtable, and a format such as '%{yyyy-MM-dd}D%f', and perhaps specifying an appropriate delimiter, works for you.
카테고리
도움말 센터 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!