Reputation: 603
I have got a vector a and a vecor b. And a have bound vectors lb and ub. I want to replace: a[i] = b[i] if lb[i]<b[i]<ub[i]. How should I do it without loops?
a
b
lb
ub
a[i] = b[i]
lb[i]<b[i]<ub[i]
Upvotes: 1
Views: 58
Reputation: 2063
M = lb < b & b < ub; a(M) = b(M);
Upvotes: 5