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));
Matt J
Matt J
上次活动时间: 2024-1-29

Is there a reason for TMW not to invest in 3D polyshapes? Is the mathematical complexity of having all the same operations in 3D (union, intersection, subtract,...) prohibitive?
Matt J
Matt J
上次活动时间: 2024-3-1

Would it be a good thing to have implicit expansion enabled for cat(), horzcat(), vertcat()? There are often situations where I would like to be able to do things like this:
x=[10;20;30;40];
y=[11;12;13;14];
z=cat(3, 0,1,2);
C=[x,y,z]
with the result,
C(:,:,1) =
10 11 0
20 12 0
30 13 0
40 14 0
C(:,:,2) =
10 11 1
20 12 1
30 13 1
40 14 1
C(:,:,3) =
10 11 2
20 12 2
30 13 2
40 14 2
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