adding a date column to a matrix
12 views (last 30 days)
Show older comments
Salma fathi
on 1 Feb 2022
Answered: Walter Roberson
on 1 Feb 2022
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.
0 Comments
Accepted Answer
Walter Roberson
on 1 Feb 2022
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 Comments
More Answers (0)
See Also
Categories
Find more on Time Series Objects 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!