Problem with creating datetime and number array
古いコメントを表示
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!
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Dates and Time についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!