24 views (last 30 days)

I have a vector Lon which I have created after spline interpolation of lon vector

Lon = [...

88.5000

88.0000

87.5000

87.0000

86.5000

86.0000

85.5000

85.0000

84.5000

84.0000

83.5000

83.0000

82.5000

82.0000

81.5000

81.0000

80.5000

80.0000

79.5000

79.0000]

I want to arrange Lon vector with respect to vector lon my lon vector is given below

lon =

88.5000

85.0000

81.0000

79.0000

80.0000

The vector Lon is in descending ordering after interpolation. I want such arrangement of elements in Lon vector

Lon=

88.5

88

87.5

87

86.5

86

85.5

85

84.5

84

83.5

83

82.5

82

81.5

81

79.5

79

80

80.5

Please check the arrangement of 3,4,5 element of lon. I want Lon should be in the same manner of lon .

Please guide me. I am stuck a lot in this sorting!

John D'Errico
on 22 Nov 2017

Edited: John D'Errico
on 22 Nov 2017

You appear to be looking to bin your data. Use histcounts. (REALLY!) Read the help.

Opportunities for recent engineering grads.

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

Start Hunting!
## 7 Comments

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/368330-how-to-custom-sort-a-vector-with-respect-to-another-vector-of-unequal-length#comment_507640

⋮## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/368330-how-to-custom-sort-a-vector-with-respect-to-another-vector-of-unequal-length#comment_507640

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/368330-how-to-custom-sort-a-vector-with-respect-to-another-vector-of-unequal-length#comment_507643

⋮## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/368330-how-to-custom-sort-a-vector-with-respect-to-another-vector-of-unequal-length#comment_507643

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/368330-how-to-custom-sort-a-vector-with-respect-to-another-vector-of-unequal-length#comment_507785

⋮## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/368330-how-to-custom-sort-a-vector-with-respect-to-another-vector-of-unequal-length#comment_507785

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/368330-how-to-custom-sort-a-vector-with-respect-to-another-vector-of-unequal-length#comment_508550

⋮## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/368330-how-to-custom-sort-a-vector-with-respect-to-another-vector-of-unequal-length#comment_508550

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/368330-how-to-custom-sort-a-vector-with-respect-to-another-vector-of-unequal-length#comment_509401

⋮## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/368330-how-to-custom-sort-a-vector-with-respect-to-another-vector-of-unequal-length#comment_509401

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/368330-how-to-custom-sort-a-vector-with-respect-to-another-vector-of-unequal-length#comment_509473

⋮## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/368330-how-to-custom-sort-a-vector-with-respect-to-another-vector-of-unequal-length#comment_509473

## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/368330-how-to-custom-sort-a-vector-with-respect-to-another-vector-of-unequal-length#comment_510310

⋮## Direct link to this comment

https://de.mathworks.com/matlabcentral/answers/368330-how-to-custom-sort-a-vector-with-respect-to-another-vector-of-unequal-length#comment_510310

Sign in to comment.