Reputation: 9
I was wondering how to divide two arrays
a = [1,2,3,4,5]
b = [2,4,6,8,15]
to get
a/b = [0.5,0.5,0.5,0.5,0.3]
Thanks in advance for the help.
Upvotes: -1
Views: 256
Reputation: 1
Just express the arrays as floating variables or doubles, then you will get the desired results. Otherwise, the results will come as 0.0 as it rounds up to the lowest integer. I hope it will work.
Upvotes: 0
Reputation: 2386
Most operations in IDL are performed element-wise, so doing c = a / b
will do what you want here.
Upvotes: 0