From: Vinh Le on
Almost get it for n = 1, try

A = [ 0 0 0 0 0 0 0;
0 0 0 1 1 1 1;
0 0 1 0 0 1 1;
0 0 1 1 1 0 0;
0 1 0 0 1 0 1;
0 1 0 1 0 1 0;
0 1 1 0 1 1 0;
0 1 1 1 0 0 1;
1 0 0 0 1 1 0;
1 0 0 1 0 0 1;
1 0 1 0 1 0 1;
1 0 1 1 0 1 0;
1 1 0 0 0 1 1;
1 1 0 1 1 0 0;
1 1 1 0 0 0 0;
1 1 1 1 1 1 1]


[r, c] = size(A);
resultMatrix = [];
for i=1:r
row = A(i,:);
resultMatrix =[resultMatrix;row];
for j=0:r-1
saveRow = row;
try
if row(1,c-j) == 1
row(1,c-j) = 0;
else
row(1,c-j) = 1;
end
addedRow = row;
row = saveRow;
resultMatrix = [resultMatrix;addedRow];
catch
end
end
end


=====================
From: Matt J on
"Vinh Le" <lekhanhvinh(a)gmail.com> wrote in message <ho3qp9$mqn$1(a)fred.mathworks.com>...
> Almost get it for n = 1, try
>
> A = [ 0 0 0 0 0 0 0;
> 0 0 0 1 1 1 1;
> 0 0 1 0 0 1 1;
> 0 0 1 1 1 0 0;

===================

Here's an automatic way to compute A for arbitrary number of colums and arbitrary n

m=6;
n=3;

idxc=nchoosek(1:m,n);
[p,q]=size(idxc);

idxr=repmat((1:p).',1,q);

A=false(p,m);

A( sub2ind([p,m],idxr,idxc) )=true,



From: Jos (10584) on
"Vinh Le" <lekhanhvinh(a)gmail.com> wrote in message <ho3k5d$9g8$1(a)fred.mathworks.com>...
> I have a binary matrix A (3x7):

I am not sure I understand your problem completely, but perhaps PERMPOS might be useful here:

http://www.mathworks.com/matlabcentral/fileexchange/11216-permpos

A small example:

permpos(2,4)
% 1 1 0 0
% 1 0 1 0
% 1 0 0 1
% 0 1 1 0
% 0 1 0 1
% 0 0 1 1

hth
Jos