Borrar filtros
Borrar filtros

adding a date column to a matrix

7 visualizaciones (últimos 30 días)
Salma fathi
Salma fathi el 1 de Feb. de 2022
Respondida: Walter Roberson el 1 de Feb. de 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.

Respuesta aceptada

Walter Roberson
Walter Roberson el 1 de Feb. de 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?

Más respuestas (0)

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by