sort a matrix of size m x 3 with respect to column 2 and then column 1 -

1 回表示 (過去 30 日間)
Bikiran Das
Bikiran Das 2016 年 9 月 6 日
コメント済み: Bikiran Das 2016 年 9 月 6 日
Column 2 data : year column 1 data : yearday (i.e 31st jan 12:00 = 31.5 and 1st feb 15:00 = 32.61(appx.)) column 3 data: variables should be in same position with respect to column 1&2 data sample of data is attached
1 2012 10.8009999374549
1 2013 12.5300001621246
1 2014 8.64066669543584
1.04166666666667 2009 135.492667007446
1.04166666666667 2010 117.759667078654
1.04166666666667 2011 137.985334142049
1.04166666666667 2012 129.988331604004
1.04166666666667 2013 151.069999186198
1.04166666666667 2014 97.3636671702067
1.08333333333333 2009 339.422002919515
1.08333333333333 2010 299.247665405273
1.08333333333333 2011 360.547666931152
1.08333333333333 2012 291.263663482666
1.08333333333333 2013 373.575331624349
1.08333333333333 2014 282.621665700277
1.12500000000000 2009 418.887999979655
1.12500000000000 2010 410.165329996745

採用された回答

dpb
dpb 2016 年 9 月 6 日
sortedData=sortrows(data([2 1]); % doc sortrows for details

その他の回答 (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