Chris,
I am unable to duplicate your problem with the code you posted. In fact, it compiles and runs without a problem here. In order to call it, I typed
A = 1:10;
[st00 en00 Z] = noisy_region_remove_puls(0, A, 0, 0);
What issues did you find with parentheses and & signs? I'm not sure if you changed lines of code in this file, but the if statement probably isn't parsing as you intended:
if Z(i) == 0 and (Z(i) - Z(i-1) < 0)
st00(k1)=i;
k1=k1+1;
elseif Z(i-1) == 0 and (Z(i) - Z(i-1) > 0)
en00(k2) =i-1;
k2=k2+1;
end
parses as
if Z(i) == 0
and(Z(i) - Z(i-1) < 0)
st00(k1)=i;
k1=k1+1;
elseif Z(i-1) == 0
and(Z(i) - Z(i-1) > 0)
en00(k2) =i-1;
k2=k2+1;
end
Most likely what you want is
if (Z(i) == 0 && (Z(i) - Z(i-1) < 0))
elseif (Z(i-1) == 0 && (Z(i) - Z(i-1) > 0))
The code still compiles correctly with those changes for me. What version of LabVIEW are you using so I can make sure to try to compile this code in the same one: 8.0 or 8.0.1? Also, if you load this file into the script editor in the MathScript window and click Save & Compile, what is displayed in the Output Window?
Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments