MATLAB Central Discussions - Join the conversation!
主要内容

搜索


Given a vector v whose order we would like to randomly permute, many would perform the permutation by explicitly querying the length/size of v, e.g.,
I=randperm(numel(v));
v=v(I);
However, one can instead do as follows, avoiding the size query.
v=v(randperm(end))
Analogous things can be done with matrices, e.g.,
A=A(randperm(end), randperm(end));
None
30%
Less than what tasks demand
40%
Sufficient for what tasks demand
20%
More than sufficient
5%
Too much
4%
384 个投票
All of the time
5%
Most of the time
45%
Less than half the time
34%
Never
12%
It doesn't matter
3%
806 个投票
Set breakpoints
60%
Run with "Pause On Errors"
11%
The dbstop() command
2%
Pause the code with keyboard()
3%
Get help from Matlab Community
16%
Other
7%
2506 个投票
Go to top of page