Identifying the first number in a series in the same vector?

2 views (last 30 days)
I need to identify the first number in a series that is within the same vector such as:
1.97756000000000
1.97784000000000
1.97856000000000
1.97884000000000
1.97912000000000
1.97920000000000
6.28712000000000
6.28968000000000
6.29108000000000
6.29148000000000
6.29180000000000
11.6901600000000
11.6903200000000
11.6904800000000
11.6906400000000
11.6910400000000
16.0839200000000
16.0843600000000
16.0850400000000
16.0852400000000
16.0856800000000
20.4872000000000
20.4883200000000
20.4885600000000
20.4887200000000
I need to list the first 1, 6, 11, 16...etc. Any help is appreciated for this basic question!

Accepted Answer

Jon
Jon on 6 Dec 2021
Edited: Jon on 6 Dec 2021
define your vector as x then
y = unique(floor(x))
floor gets rid of the decimal part, unique gets rid of the repetitions

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!