Matlab置换函数
如何在Matlab中实现以下排列(来自Mathematica)Matlab置换函数,matlab,permutation,Matlab,Permutation,如何在Matlab中实现以下排列(来自Mathematica) ColumnNow that I know what you're really after, April2Options is a structure array where each element consists of 4 fields. If I am interpreting your comments correctly, you simply wish to shuffle each structure aroun
ColumnNow that I know what you're really after, April2Options
is a structure array where each element consists of 4 fields. If I am interpreting your comments correctly, you simply wish to shuffle each structure around in the array. Use randperm
for that:
April2Options_Perm = April2Options(randperm(numel(April2Options));
Column现在我知道您真正想要什么了,April2Options
是一个结构数组,其中每个元素由4个字段组成。如果我正确地解释了您的评论,您只需要在数组中对每个结构进行洗牌。用于:
randperm
接受一个正整数N
,它返回一个介于1到N
之间的整数向量,其中这些整数的顺序被洗牌,因此值的排列从1到N
。我们可以使用此输出作为April2Options
的索引,以洗牌顺序,并存储在April2Options\u Perm
中,而不知道任何Mathematica:April2Options排列的输出是什么?所有这些未知字符是什么?您可以编辑您的帖子,使所有字符都是正确的吗可读?perms
接受一个数字向量,并提供该向量的所有可能排列。而不是向MATLAB用户展示一个代码,其中。。。也许我们大多数人。。。我不知道它在做什么,你能用简单的英语描述一下你想要完成什么吗?我想让Matlab输出一个结构数组(mx4),其中每一行