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

조회 수: 1 (최근 30일)
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 CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by