How do I create a set of random numbers with a given set of numbers? Using randi command.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Thanakorn Runglerdkriangkrai
am 22 Sep. 2020
Kommentiert: Thanakorn Runglerdkriangkrai
am 22 Sep. 2020
This is my code,
a = [8 5 2 6 9 3 1 4 0 7];
randi(imax,n);
When I run it, there is an error, "Unrecognized function or variable 'imax' ". So I am wondering what is my mistake here?
0 Kommentare
Akzeptierte Antwort
madhan ravi
am 22 Sep. 2020
Bearbeitet: madhan ravi
am 22 Sep. 2020
a(randi(numel(a), 1, numel(a))) % for unique numbers use randperm()
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices 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!