Problem with creating datetime and number array
Show older comments
Hello!
I'm trying to convert the first column to datetime format, then write the two columns to an array:
19036.055 68.5714
19036.906 70.4225
19037.758 70.4225
19038.633 68.5714
19039.547 65.6455
19040.469 65.0759
19041.367 66.8151
19042.219 70.4225
19043.117 66.8151
May I ask what is wrong with my code?
nDat = size(hrData.VarName1,1);
BPMdata = zeros(nDat,2);
for nCount = 1:nDat
BPMdata(nCount,1) = datetime(hrData.VarName1(1:end), 'ConvertFrom','posixtime');
BPMdata(nCount,2) = hrData.VarName2(1:end);
end
This is the error message: "The following error occurred converting from datetime to double: Undefined function 'double' for input arguments of type 'datetime'. To convert from datetimes to numeric, first subtract off a datetime origin, then convert to numeric using the SECONDS, MINUTES, HOURS, DAYS, or YEARS functions."
Thank you!
1 Comment
newton zeus
on 2 May 2020
Accepted Answer
More Answers (0)
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!