Datetime coloumn in a matrix of double

1 visualización (últimos 30 días)
Andrea Sbaragli
Andrea Sbaragli el 12 de Mayo de 2021
Comentada: Stephan el 12 de Mayo de 2021
I start from this matrix A = mx 4 where
1- epoch time in nanosec
2- number double
3- number double
4- number double
Through this function "datetime(T1(i,1),'ConvertFrom','epochtime','TicksPerSecond',1e9,'Format','dd-MMM-yyyy HH:mm:ss.SSSSSSSSS')" I created an array mx1 where I converted the epoch time to date time
At this point I m looking to create the same matrix as before replacing the first coloumn with the new created vector but it returns me an error because date type are not equal. How to do that?

Respuesta aceptada

Stephan
Stephan el 12 de Mayo de 2021
Editada: Stephan el 12 de Mayo de 2021
You can not mix data types in arrays - use a table or a timetable to do this. In your case the array2table or array2timetable might be useful.
  2 comentarios
Andrea Sbaragli
Andrea Sbaragli el 12 de Mayo de 2021
Ok it works in this way but afterward I cannot operate anymore in values inside. What do you suggest? it is more convenient keep separate them?
Stephan
Stephan el 12 de Mayo de 2021
You access table elements using this notation:
A{:,1} % all rows of column 1
A{1:5,4} % rows 1...5 of column 4

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by