Registered Member
|
Hi all,
I'm new to eigen and try to use it in my code. I need to find all coefficients that is above a threshold in a vector but I can't figure out how to do this. Here is what I already do : VectorXf v(5); v << 1,4,5,2,3; if I do v.array() > 3; it returns a binary vector but I can't do some thing like : v[v.array() > 3]; neither VectorXb mask = v.array() > 3; What is the correct way to do this ? Thanks for your help, Jaonary |
Moderator
|
hm, VectorXb mask = v.array() > 3; should be ok. And then you will have to do some manual job to mimic the MatLab feature:
v[v.array() > 3]; that we plane to support asap... |
Moderator
|
oh, if
VectorXb mask = v.array() > 3; does not work, then rather do: VectorXb mask ; mask = v.array() > 3; that's just some usual C++ annoyance. |
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]