Timestamp char or cell into double matrix
Ältere Kommentare anzeigen
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.
Akzeptierte Antwort
Weitere Antworten (1)
madhan ravi
am 16 Nov. 2018
0 Stimmen
Kategorien
Mehr zu Time Series Objects finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!