フィルターのクリア

Unable to Sort Mixed Data Type Cell array

3 ビュー (過去 30 日間)
sc1991
sc1991 2017 年 12 月 7 日
コメント済み: sc1991 2017 年 12 月 8 日
Hi! I have a cell array with 5 column which has time series data in it. just to give a quick background I initially had 5 variables some double and some string and I concatenated them. To make one cell array. I used the following
new=[Data_Number,Date,num2cell(xyz),num2cell(Software),num2cell(abs_time)]
Now, the reason why i did this was beacuse of this issue
'2017-03-19' 736773.803
'2017-03-19' 736773.8048
'2017-03-19' 736773.834
'2017-03-20' 736773.8374
'2017-03-20' 736773.9578
'2017-03-20' 736773.9617
'2017-03-19' 736773.9687
'2017-03-19' 736774.0073
'2017-03-19' 736774.0122
'2017-03-19' 736774.0174
'2017-03-20' 736774.047
So, here if you see while logging the data it went from 19th to 20 and then came back to 19. So I thought I will use abs time and sort that and change the corresponding 5 columns with it.(Sorry I could show only 2 column here but there are 3 more).
I tried something like this:
sortrows(new,5);
abstime is in 5th column.
But since I have made this cell with different data types I am somehow not able to alter the whole cell based on one column.
Please can any one help me with it.

採用された回答

Guillaume
Guillaume 2017 年 12 月 8 日
Other solution, convert your cell array to a table. Use sortrows.
tnew = cell2table(new);
sortrows(tnew, 5)
You don't even need to bother with the cell array
tnew = table(Data_Number ,Date, xyz, Software, abs_time);
sortrows(tnew, 5)
  1 件のコメント
sc1991
sc1991 2017 年 12 月 8 日
you my friend just saved my day. Thanks a lot for the help. Thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by