Reputation: 7746
I have a data cells that contain these types. The type of the first cell is string, which contains a datetime like this '2017-09-20 15:35:00'
celldisp(data)
{935×1 cell} [935×1 double] [935×1 double] [935×1 double] [935×1 double] [935×1 int32] [935×1 int32]
I would like to convert this to a more friendly timeseries like object. But for example, when I say
dataArray=table2array(data);
disp(dataArray);
All I see is the datetime column, not the rest of the columns of double in the table.
What is the correct way to do this?
Upvotes: 1
Views: 52
Reputation: 486
If you convert data
to a table structure first and then to an array it should work:
Example_cell={'2017-09-20 15:35:00',3,5 ;'2017-09-20 16:35:00', 4, 7}
Example_table=table(Example_cell)
Example_array=table2array(Example_table)
Output:
Example_array =
'2017-09-20 15:35:00' [3] [5]
'2017-09-20 16:35:00' [4] [7]
Example_array(1)
ans =
'2017-09-20 15:35:00'
Example_array(2)
ans =
'2017-09-20 16:35:00'
Example_array(3)
ans = [3]
Upvotes: 1