how to change the columns of matrix using row index

2 Ansichten (letzte 30 Tage)
nadia nadi
nadia nadi am 27 Jul. 2015
Kommentiert: nadia nadi am 13 Sep. 2015
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

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 27 Jul. 2015
  1 Kommentar
nadia nadi
nadia nadi am 13 Sep. 2015
Dear Walter,
sorry for late to accept your answer. Thanks.
Nadia

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by