jeudi 7 mai 2015

Choose random elements of a matrix in a range of rows and columns

Consider a m*n zero matrix. I want to select some elements randomly in a specific range of rows and columns in a way that they somehow show some linear trend and put them equal to 1. I created a pic to illustrate what I mean

enter image description here

Also, I need some of these randomly selected columns have more than one nonzero element. How can I generate these kind of matrices?




Aucun commentaire:

Enregistrer un commentaire