登录论坛

查看完整版本 : 行的随机顺序Matlab


poster
2019-12-14, 20:46
假设我们有一个尺寸为100x3的矩阵

您将如何在MATLAB中随机排列行?



回答:

要随机排列矩阵的行,可以使用RANDPERM (http://www.mathworks.com/help/techdoc/ref/randperm.html)

shuffledArray = orderedArray(randperm(size(orderedArray,1)),:); randperm将生成的列表N随机值以及对它们进行排序,并返回的第二输出sort作为结果。



更多&回答... (https://stackoverflow.com/questions/5444248)