vendredi 16 juin 2017

Create random values in vector Matlab

I have this vector:

Population = [3, 5, 0, 2, 0, 5, 10, 50, 0, 1];

And i need to fill this vector with a random value between 1 and 4 only where have 0 value in vector.

How i can do it ?

Edit: there's a way to do it using randperm function?




Aucun commentaire:

Enregistrer un commentaire