# MATLAB: For Loop Help Needed

detrendfor loop

Hey guysss,
So I am trying to write a for loop to automatically detrend my signal until the "constant" value, or 0. I am using an updated detrend function that allows for higher order detrending rather than just linear.
%Detrend
Order.Max = 5;
X = 0:Order.Max – 1;
X = sort(X,'descend');
T1.Prc = detrend(T1.Sig1,Order.Max);
T2.Prc = detrend(T2.Sig1,Order.Max);
T3.Prc = detrend(T3.Sig1,Order.Max);
T4.Prc = detrend(T4.Sig1,Order.Max);
T5.Prc = detrend(T5.Sig1,Order.Max);
for Order.Low = X,
T1.Prc = detrend(T1.Prc,Order.Low);
T2.Prc = detrend(T2.Prc,Order.Low);
T3.Prc = detrend(T3.Prc,Order.Low);
T4.Prc = detrend(T4.Prc,Order.Low);
T5.Prc = detrend(T5.Prc,Order.Low);
end
I keep getting this error: ??? Error: File: fieldanalysisPART1.m Line: 18 Column: 10 Unexpected MATLAB operator.
Can you help me correct this? I essentially want the for loop to detrend the original signal T1.Sig1 with the highest order (for example, Order.Max = 5) and save it to T1.Prc. Then, I want the for loop to detrend T1.Prc with 4,3,2,1, and 0.

for Order.Low = X,
for x = X  Order.Low = x;
X = 0:Order.Max-1;X = sort(X, 'descend');
X = Order.Max-1 : -1 : 0;