jeudi 25 janvier 2018

New to matlab and need some help regarding lists/vectors and how to make them

I want to make a list/vector which is from say a to b and from there i would like to basically make another list and pick 100 numbers from my list for random numbers (it can repeat) and put it in that list.

So it is like i have a list

 A = [a,a+1,a+2 .... b]
 B = empty list
 for i=1:100
     B[i] = random element from A
 end

but i do not understand how to do this, i tried using rand(a,b) but that is giving me a matrix.




Aucun commentaire:

Enregistrer un commentaire