samedi 18 mars 2017

Storing Indices of a Generated Random Matrix in a Seperate Matrix

I am generating a random graph G of 9 * 9 matrix:

G = round(rand(9));
G = triu(G) + triu(G,1)';
G = G - diag(diag(G))

And I am extracting randomly some rows and columns from above matrix:

k = randperm(9);
mnew = G(k(1:4),k(2:6));

mnew =

0     1     0     0     1
0     1     0     1     0
1     0     1     1     1
0     1     0     0     1

Now, I want to create a matrix storing the indices of rows and columns which got extracted in mnew




Aucun commentaire:

Enregistrer un commentaire