フィルターのクリア

adding a date column to a matrix

7 ビュー (過去 30 日間)
Salma fathi
Salma fathi 2022 年 2 月 1 日
回答済み: Walter Roberson 2022 年 2 月 1 日
haveing the followoing matrix
EDP = [double(netcdf.getVar(ncid,0)),double(netcdf.getVar(ncid,1)),double(netcdf.getVar(ncid,2)),double(netcdf.getVar(ncid,3)),double(netcdf.getVar(ncid,4)),double(netcdf.getVar(ncid,5))];
%[Height, Latitude, Longitude, Azimuth, TEC, Ne]
and the following date corresponding to this matrix
EDPdate= datetime(Year, Month, Day, Hour, Min, 0,'TimeZone','UTC','Format', 'uuuuMMddHHmm');
EDPdate.TimeZone='America/Lima';
how I can add a new column to the matrix and store in it this date value, for all the rows.

採用された回答

Walter Roberson
Walter Roberson 2022 年 2 月 1 日
You cannot do that.
The double() present in the first expression shows that EDP is an array of double precision numbers. The datetime() in EDPdate, reinforced with setting the TimeZone, shows that EDPdate is desired to be a datetime object. However it is not possible to store a datetime object in a double array .
You could convert the datetime object to a serial date number, which would potentially lose precision, and would certainly lose the timezone.
Have you considered changing from using an array to using a table() object?

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by