필터 지우기
필터 지우기

how to add a time column to a matrix

조회 수: 2 (최근 30일)
zeezo
zeezo 2016년 5월 8일
댓글: zeezo 2016년 5월 8일
a=['07:00:00'; '07:15:00'; '07:30:00'];
% add 60 seconds to 07:00 , 85sec to 07:15 and 136sec to 07:30
add = [60; 85; 136];
sec_per_day = 24*60*60;
Result = datestr(datenum(a, 'HH:MM:SS') + add/sec_per_day, 'HH:MM:SS')
Result =
07:01:00
07:16:25
07:32:16
Now I want to add the Result to matrix ( K )to become the 3rd column K=[34 45; 75 345; 35 65]
How can I do that?

답변 (1개)

Walter Roberson
Walter Roberson 2016년 5월 8일
Result is a string. It is not possible to have strings in a numeric matrix. You need to use cell arrays or table() or dataset()
  댓글 수: 1
zeezo
zeezo 2016년 5월 8일
thank you
how can I use cell arrays or table() or dataset()?

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by