Borrar filtros
Borrar filtros

when converting a time into an array I lose the date column

2 visualizaciones (últimos 30 días)
aldo
aldo el 15 de Ag. de 2023
Comentada: Walter Roberson el 15 de Ag. de 2023
>> class(tab)
ans =
'timetable'
cc=table2array(tab)
  3 comentarios
aldo
aldo el 15 de Ag. de 2023
Editada: aldo el 15 de Ag. de 2023
i want to convert this datatime to arraystring (i want to use it using uitable and display it in a table)

Iniciar sesión para comentar.

Respuestas (2)

Florian Bidaud
Florian Bidaud el 15 de Ag. de 2023
The first class is a 16x1 timetable. This means the time column is not a variable but is the indexing column.
You don't have to convert this into a table to have access to your data. You can use your_table.Profit(1) to return 7.9867e5 for example. If you need the date, then use your_table.Time(1).
If you still wish to convert this into a table, you can do as following:
for i = 1:length(a.Time)
cc{i,1} = your_table.Time(i);
cc{i,2} = your_table.Profit(i);
end

Dyuman Joshi
Dyuman Joshi el 15 de Ag. de 2023
"(i want to use it using uitable and display it in a table)"
Convert the timetable to table and use accordingly -
tableName = timetable2table(tableName);
fig = uifigure;
uit = uitable(fig,"Data",tableName);
  1 comentario
Walter Roberson
Walter Roberson el 15 de Ag. de 2023
Right. uitable() that are children of uifigure() can handle table() objects directly.

Iniciar sesión para comentar.

Categorías

Más información sobre Tables en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by