MATLAB Answers

How to find a vector in a matrix?

78 views (last 30 days)
M G
M G on 4 Sep 2013
Commented: nalja mot on 25 Dec 2018
Hi all,
Assume a vector:
v = [1:3:1000];
How can I find the number of columns of each value in the vector:
x = [100, 280, 781, 925, 997];
in the bigger vector, v.
I tried:
y = find(x == v)
But no success! Any hint is greatly appreciated :)

  0 Comments

Sign in to comment.

Accepted Answer

Matt J
Matt J on 4 Sep 2013
[~,y]=ismember(v,x)

More Answers (0)

Tags