For example, by using the function: rmoutliers I get this (blue: my spectrum; red: spectrum after rmoutliers function)
The code is:
X=lambda;
Y=intensity;
[B,TF] = rmoutliers(Y,'movmedian',X(200),'SamplePoints',X);
figure;
plot(X,Y,'b-',lambda(~TF),B,'r-');
legend('Input Data','Output Data');