Timestamp char or cell into double matrix
이전 댓글 표시
I have a script to discover missing time periods in large data sets that begin with a Timestamp (TS). The TS is in form of "yyyy-mm-dd HHMM"
The script imports the data into a cell array C:
data = cell2mat(cellfun(@str2double,C,'UniformOutput',false));
but all the functions within work on double matrix variables. This includes the output matrix, which is fprint'd into a new file.
What I need to do is retain the original TS as a character-type column in the output matrix. Since the point of the script is to fill in holes and remove duplicates, I must apply the index which maps out the missing stuff to the TS.
I have a few different ways to get the TS, but none of them is adequate. I can:
TSdnum=datenum(TS_filtered)
TSnew = datestr(TSdnum,31)
This somehow generates a timestamp which is 1 minute off. For example 2015-03-15 15:15 comes out as 2015-03-15 15:16
I can get a character array out of the cell:
TSraw = cell2mat(C{1})
but I don't know how to put this into the final array. I have used cell2string(strsplit(.... before but don't see how this can work.
I think I can make a table, and use .Format, but again, how to get into my output matrix.
채택된 답변
추가 답변 (1개)
madhan ravi
2018년 11월 16일
0 개 추천
카테고리
도움말 센터 및 File Exchange에서 Time Series Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!