Sometimes, when we check unique entries of vector we would like to know how many times each value occurs.

Given vector of numbers A return vector U of unique values of A and corresponding vector H with occurrences.

Example:

   in:  A = [2 2 2 3 3 2 3 8 6 5 6]
  out:  U = [2 3 8 6 5]
        H = [4 3 1 2 1]  

Solution Stats

330 Solutions

140 Solvers

Last Solution submitted on May 05, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers140

Suggested Problems

More from this Author40

Community Treasure Hunt

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

Start Hunting!