Specific Element Count - MATLAB Cody - MATLAB Central

Problem 367. Specific Element Count

Difficulty:Rate

Given a vector v and a element e, return the number of occurrences of e in v.

Note: NaNs are equal and there may be no occurrences of e in v

Example:

v = 1:10
e = 2
output = 1

Solution Stats

30.03% Correct | 69.97% Incorrect
Last Solution submitted on Nov 16, 2025

Problem Comments

Solution Comments

Show comments
Join Cody Contest 2025 — Have Fun and Win Prizes!
...
We’re excited to invite you to Cody Contest 2025! 🎉 Pick a team,...

Problem Recent Solvers922

Suggested Problems

More from this Author56

Community Treasure Hunt

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

Start Hunting!