Conversion of {} in () with cell2table
古いコメントを表示
I have this cell array :

I do this command :
data = cell2table(data, 'VariableNames',{'Date' 'ap' 'cp'});
And I have this :

My problem is that the third column has the {} (like data.cp{61,1} in the example), while the second column has the () (like data.ap(61,1) in the example)
Why do I get this ? And how can I fix it ? I would like to have () for both
Thanks
採用された回答
その他の回答 (1 件)
Peter Perkins
2017 年 10 月 19 日
0 投票
It's impossible to say for sure what is happening because all you've posted is a screenshot. My best guess is that you started with a 67x3 cell array, the first column of which contained a char row vector in each cell (a date string, actually), the second column of which contained a scalar struct in each cell, and the tird column of which contatined a mix of scalar structys and [].
I'm guess that the table you got from cell2table containned three variables: 1) a cellstr containing date strings, which you like want to convert to a datetime vector, 2) a 67x1 struct, although it may also have been left as a 67x1 cell array containing scalar structs if the fields were different, and 3) a 67x1 cell array containing a mix of scalar structs and []
I think you need to work a bit more on these data to get them into a more useful form, especially the last thing.
カテゴリ
ヘルプ センター および File Exchange で Data Type Identification についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!