0

I wanted to replace the values within specific range to its positive values, something like:

X(X<a && X>b)=abs(X(X<a && X>b))

However I get error saying that

Operands to the || and && operators must be convertible to logical scalar values.

Any ideas how to fix it? Thanks!

Gregor Isack
  • 1,111
  • 12
  • 25
  • 1
    Replace `&&` with `&`. The use of `&&` if for conditions, not for indexing. – Adiel Oct 25 '17 at 07:42
  • @Adiel Why dont you add your comment as an answer? – Irreducible Oct 25 '17 at 07:43
  • 1. I convinced there already an answer for that over here, 2. Don't think that little sentence should be an answer. 3. If you want to elaborate this to an answer, with links, implications, etc., you welcome – Adiel Oct 25 '17 at 07:47
  • Can't believe I made such mistake. But what's the different between `&&` and `&` in this context? Usually we will use `&&` in `if` statement, this is an exception? As I understood, `&&` will force check the condition after `&&`. – Gregor Isack Oct 25 '17 at 07:49
  • Okay few seconds behind hahaha – Gregor Isack Oct 25 '17 at 07:50

0 Answers0