I'm sorry to be asking a basic question, but I've been working on a signal analysis project for which we need to assign a variable based on which quadrant a set of values (n-dimensional vector) lies in. As a biomedical engineer, I've been struggling to maybe find a more efficient or "prettier" solution. Currently, the way in which I'm working for a 3 dimensional vector is by doing multiple comparissons:
if (ondas[0]>0)&(ondas[1]>0)&(ondas[2]>0):
note=1
elif (ondas[0]>0)&(ondas[1]>0)&(ondas[2]<0):
note=2
elif (ondas[0]>0)&(ondas[1]<0)&(ondas[2]<0):
note=3
elif (ondas[0]<0)&(ondas[1]<0)&(ondas[2]<0):
note=4
elif (ondas[0]<0)&(ondas[1]>0)&(ondas[2]<0):
note=5
elif (ondas[0]<0)&(ondas[1]<0)&(ondas[2]>0):
note=6
elif (ondas[0]<0)&(ondas[1]>0)&(ondas[2]>0):
note=7
elif (ondas[0]>0)&(ondas[1]<0)&(ondas[2]>0):
note=8
else:
note=0
Where ondas is my array with 3 values. This code works sufficiently well, but I wonder if there's another way to tackle the problem. I've been working well enough with this solution, but I'm open to feedback on the issue.