How can we display a value of function inside for loop seperatley instead of in a form of vector?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
omar th
am 17 Feb. 2023
Kommentiert: omar th
am 21 Feb. 2023
when I excuted the code below, " select" show me the options as vector, but I want it show me these options in random way BUT WITHOUT REPEATING as follow in each iteration, for example,
2
5
3
4
1
options = [1 2 3 4 5];
for i= 1:numel(options)
select = options(randperm(i))
end
Thanks in advance
0 Kommentare
Akzeptierte Antwort
Dyuman Joshi
am 17 Feb. 2023
A = [1 2 3 4 5];
options=randperm(numel(A));
for i= 1:numel(options)
select = options(i)
end
4 Kommentare
Dyuman Joshi
am 21 Feb. 2023
So you want run each loop once in a random order, for every iteration of main loop?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements 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!