Problem 105. How to find the position of an element in a vector without using the find function

Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for.


 findPosition([1 3 5 4 2], 2)
 posX is 5
 findPosition([1 5 8 6 7 6 0], 8)
 posX is 3

Solution Stats

65.74% Correct | 34.26% Incorrect
Last solution submitted on Oct 20, 2016

Problem Comments

Solution Comments


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more