mchen
mchen

Reputation: 10156

How to get positions of element matches in a list in kdb?

For instance, if I have a list a:2 5 3 1, I can match another list against it, say b:3 5, which matches the 3 at a[2] and the 5 at a[1]. I am interested in getting my hands on the indices 2 1.

I tried where 3 5 in 2 5 3 1 but didn't work.

Upvotes: 1

Views: 2091

Answers (1)

WooiKent Lee
WooiKent Lee

Reputation: 1311

I think you should use ? for this:

q)2 5 3 1?3 5
2 1

http://code.kx.com/q/ref/search/#find

Upvotes: 3

Related Questions