How can we display a value of function inside for loop seperatley instead of in a form of vector?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Dyuman Joshi
2023-2-17
A = [1 2 3 4 5];
options=randperm(numel(A));
for i= 1:numel(options)
select = options(i)
end
4 个评论
Dyuman Joshi
2023-2-21
So you want run each loop once in a random order, for every iteration of main loop?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!