Let me clarify further, I would like to run these two tests shown below together and then export the series that have passed the condition to excel but would also need to know the variables that were exported. Can someone help in how to export the results and on how to identify which of the original series are exported.
Here's a similar example as above but with some time series and two conditions present.
%% %data and aggregate x1=[10 8 10]'; x2=[30 29 45]'; x3=[40 15 85]'; x4=[3 2 8]'; x=[x1,x2,x3,x4] xTL=sum(x,2) xTL=xTL(1);
%extracting recent values x_1=x1(1); x_2=x2(1); x_3=x3(1); x_4=x4(1);
%% %diff and percent changes xN=[NaN NaN NaN NaN]; x_d=[diff(-x); xN]; x_p=x_d./x;
%extracting recent percent change for test x1_p=x_p(1,1); x2_p=x_p(1,2); x3_p=x_p(1,3); x4_p=x_p(1,4);
%% test to filter data x=[]; pct=.10;
test1 = pct * xTL; test2 = .05;
%conditional test if ((x_1 > test1) & (abs(x1_p) > test2)) fprintf('Adding on x1:\n'); x = [x, x1]; end
if ((x_2 > test1) & (x2_p > test2)) fprintf('Adding on x2:\n'); x = [x, x2]; end
if ((x_3 > test1) & (x3_p > test2)) fprintf('Adding on x3:\n'); x = [x, x3]; end
if ((x_4 > test1) & (x4_p > test2)) fprintf('Adding on x4:\n'); x = [x, x4]; end