how to change the columns of matrix using row index

1 次查看(过去 30 天)
dear all,
I have this matrix
a=[1 0 0 0 1 0; 0 0 1 0 0 1;1 0 1 0 0 0;0 0 1 0 0 1;1 1 0 0 0 0;1 0 0 0 0 0;0 0 0 1 0 0];
I chose first row and wrote it as [ 1 1 0 0 0] and I want to rearrange the matrix depends on I, I used the index
a=[1 0 0 0 1 0; 0 0 1 0 0 1;1 0 1 0 0 0;0 0 1 0 0 1;1 1 0 0 0 0;1 0 0 0 0 0;0 0 0 1 0 0];
row=a(1,:);
s=find(row==1);
row1=[0 0 0 1 1 0];
s1=find(row1==1)
s2=find(row1==0)
%a=a(:,row1);give error
to here I don't now how to use the index of row1 to change a, can anyone help me please.
regards

采纳的回答

Walter Roberson
Walter Roberson 2015-7-27

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by