Hello,
I have vector A
A=[1 2 3 4 5 6];
and I have matrix B
B= [9 7 4;3 2 1;8 22 4;5 6 24]
Matrix A is unchangeable while size of B is unchangeable but its arrangement is okay to change. B is considered as initial guess so when it order is change it should change slightly and for a reason. transfaring from a row to a new row in B means three zeros. so if I want to write it in a vector for it will be:
B1=[9 7 4 0 0 0 3 2 1 0 0 0 8 22 4 0 0 0 5 6 24 ];
now my condition:
if three consecutive element of vector A is present in six consecutive column in vector B1 then vector B1 should chnge its order by take the last column that couse the problem in B1 and exchange with last+1 column and if last+1 does not exist then by take the first column that couse the problem in B1 and exchange with first-1 column. However, the elements [0 0 0] should not be exchange and it should be in its place all the time. After finishing all changing in vector B1 and the condition that no three consecutive element of vector A is present in six consecutive column in vector B1 then the code take vector B1 to be a matrix with the same size as it was before B.
In the above example the problem in be exist in two places 1st one [3 2 1] and 2nd one [4 0 0 0 5 6].
I spent a lot of hours trying to code all this conditions but unfortunately my code dose not work. Please help me.
Thanks.