Plot large files with timestamp

조회 수: 2 (최근 30일)
Ancalagon8
Ancalagon8 2018년 11월 21일
편집: Ancalagon8 2025년 1월 6일
I have a large file and try to load it into MATLAB and plot it with timestamp.
  댓글 수: 2
Jan
Jan 2018년 11월 21일
What is your question?
Ancalagon8
Ancalagon8 2018년 11월 21일
I need help loading and plotting my large csv file with timestamp.

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

답변 (1개)

Walter Roberson
Walter Roberson 2018년 11월 21일
strcat the first two columns together with a blank between . datetime the result with an InputFormat parameter , which is required for this purpose because datetime cannot figure out fractions of a second by itself .
Now that you have timestamps and values you can prepare to plot . I think your release permitted using datetime as the X axis .
  댓글 수: 2
Walter Roberson
Walter Roberson 2018년 11월 21일
That is more work. Time of day without an attached date is handled by duration objects. In your R2016b release, duration() did not support input as time strings, so to construct the objects it would be necessary to parse the character strings into arrays of numeric values that can then be passed to duration() . It is easier to
dt = datetime( strcat(testdata{:,1}, {' '}, testdata{:,2}), 'inputformat', 'yyyy-MM-dd HH:mm:ss.SSSSSS');
You can always convert those to duration afterwards:
dur = dt - dateshift(dt(1), 'start', 'day');
After which you can plot, such as
plot(dur, testdata{:,3:4})
Walter Roberson
Walter Roberson 2018년 11월 21일
Like you posted,
testdata = read(ds);

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

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by