How to create a random array from an array
Ältere Kommentare anzeigen
Hello every one
I have a 1x450 array and I want to choose 300 elements of this array randomly and create a new array with random elements
I tried randi and randperm but these two didn't give me the answer I want
What should I use instead
Thanks in advance
2 Kommentare
Dyuman Joshi
am 16 Feb. 2023
What did you try?
Do you want 300 different indices? or 300 indices with repetitions works?
Jan
am 16 Feb. 2023
randi creates indices with repetitions, randperm without. If both methods are not working for you, the problem is hidden inside "didn't give me the answer I want". The readers cannot guess, what you have exactly tried and what you want. So please post your code and explain, what you want to change.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Number Theory finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!