필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
aldo
aldo 2023년 8월 15일
댓글: Walter Roberson 2023년 8월 15일
>> class(tab)
ans =
'timetable'
cc=table2array(tab)
  댓글 수: 3
Stephen23
Stephen23 2023년 8월 15일
편집: Stephen23 2023년 8월 15일
aldo
aldo 2023년 8월 15일
편집: aldo 2023년 8월 15일
i want to convert this datatime to arraystring (i want to use it using uitable and display it in a table)

댓글을 달려면 로그인하십시오.

답변 (2개)

Florian Bidaud
Florian Bidaud 2023년 8월 15일
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 2023년 8월 15일
"(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
Walter Roberson
Walter Roberson 2023년 8월 15일
Right. uitable() that are children of uifigure() can handle table() objects directly.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by