I have 2 waves of data. Z_EC is proton number, N_EC is neutron number, and EC_pure is a flagged wave based on certain perimeters, I.E. flag "1" if meets criteria, "0" if not.
I'm trying make a new proton and neutron wave that will have the correct values based on whether or not EC_pure is a 1 or 0 (If 1 match P to N; if 0 do nothing). However, every time I run my function, the new waves fill in the P and N values even when EC_pure = 0
Function plotECzn()
wave EC_pure, Z_EC, N_EC
variable i, j
variable len = numpnts(Z_EC)
Duplicate/O Z_EC Z_pure
Duplicate/O Z_EC N_pure
For(i=0; i<len; i+=1)
For(j=0; j<121; j+=1)
If(EC_pure[j] == 1)
Z_pure[i] = Z_EC[i]
N_pure[i] = N_EC[i]
Endif
Endfor
Endfor
End