> i need a comand to check the numbers in column A and anywhere that 6 change to 7 show me the entire rows for last 6 and where 7 changes back to 6 show me the last row in 7.
Here's a demo
Create demo table
Produce table T with variable names A,B.
A = [4;5;6;6;7;7;8;6;6;6;5;7;7;6;6;7;7;6;6;7;7];
B = round(rand(size(A))*10,2);
T = table(A,B);
disp(T)
Find index of the last 6 that changes to 7 and the last 7 that changes to 6
dA = [diff(T.A);0];
isLastSix = T.A==6 & dA==1; % bad variable name, change it
isLastSeven = T.A==7 & dA==-1; % bad variable name, change it
Show rows of table for each index
T(isLastSix,:)
T(isLastSeven,:)
