From: Anan Schahzad on
Dear All,
i am trying to write the code which can produce the following result.

count=0;
i1=101
i2=102
i3=103
j1=201
j2=202
j3=203

z2=(202,203,103,102,201,101)
the first exchnage of i and j will give

z2=(202,103,203,102,201,101)
count=1

second exchnage

z2=(103,202,203,102,201,101)
count=2

on the seven exchnage of i and j, we have bring all the j's on right side and i's on left, the result is

z2=(103,102,101,202,203,201)


it is request that please help me to write a code which can be this result. please.
From: Steven Lord on

"Anan Schahzad" <eekubkk(a)gmail.com> wrote in message
news:hrugge$4or$1(a)fred.mathworks.com...
> Dear All,
> i am trying to write the code which can produce the following result.
>
> count=0;
> i1=101
> i2=102
> i3=103
> j1=201
> j2=202
> j3=203
>
> z2=(202,203,103,102,201,101)
> the first exchnage of i and j will give
>
> z2=(202,103,203,102,201,101)
> count=1

Why? What rule are you applying that gives that result from that initial
state as opposed to, say, {202 203 103 102 101 201} or {102 203 103 202 201
101} or any other possible result?

> it is request that please help me to write a code which can be this
> result. please.

No one will be able to help you until you can clearly state what,
SPECIFICALLY, you're trying to do.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: Anan Schahzad on
"Steven Lord" <slord(a)mathworks.com> wrote in message <hruj4s$465$1(a)fred.mathworks.com>...
>
> "Anan Schahzad" <eekubkk(a)gmail.com> wrote in message
> news:hrugge$4or$1(a)fred.mathworks.com...
> > Dear All,
> > i am trying to write the code which can produce the following result.
> >
> > count=0;
> > i1=101
> > i2=102
> > i3=103
> > j1=201
> > j2=202
> > j3=203
> >
> > z2=(202,203,103,102,201,101)
> > the first exchnage of i and j will give
> >
> > z2=(202,103,203,102,201,101)
> > count=1
>
> Why? What rule are you applying that gives that result from that initial
> state as opposed to, say, {202 203 103 102 101 201} or {102 203 103 202 201
> 101} or any other possible result?
>
> > it is request that please help me to write a code which can be this
> > result. please.
>
> No one will be able to help you until you can clearly state what,
> SPECIFICALLY, you're trying to do.
>
> --
> Steve Lord
> slord(a)mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
>

actually i want a code which can give me pairwise flip,
For example:

z2=( j2, j3, i3, i2, j1, i1)
now i do pairwire flip between i and j, and at the same time counting the number of pairwire flip.
first pairwise flip, (j3,i3)
the result is
z2=( j2,i3,j3,i2,j1,i1)
second pairwise flip
z2=(i3,j2,j3,i2,j1,i1)
third pairwise flip
z2=(i3,j2,i2,j3,j1,i1)
fourth pairwire flip
z2=(i3,i2,j2,j3,j1,i1)
fifth pairwire flip
z2=(i3,i2,j2,j3,i1,j1)
sixth pairwire flip
z2=(i3,i2,j2,i1,j3,j1)
similarly at the seventh flip, we have
i2=( i3, i2, i1, j1, j3, j1)
hence we get the result in which all the i's on the left and j's on the right, order of i and j makes no difference.
what will be the possible code which can produce such result.