1

There is a vector of numbers:

y = [
2013;
2013;
2013;
2014;
2014;
2015;
2016]

Scilab function unique creates the vector km with indexes of the first occuring unique number in y:

[U, km, ku, nb] = unique(y)

km is:

1
4
6
7

I need a index vector of the last occurrence of the unique numbers like:

3
5
6
7

How can I achieve this?

1 Answer 1

1

You can just apply unique to y($:-1:1) and then let km=n-km+1 where n is the size of y

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.