[英]Creating random alingment for a matrix in matlab
How can I create an array with number from 1 to 10 for example without repeating. 例如,如何不重复创建数字从1到10的数组。 Because I will use it to re-aling a matrix's rows.
因为我将使用它重新计算矩阵的行。 For example of 1 to 10, I want my output as: 4 1 3 8 2 5 6 7 9 10 But I don't want to have repated numbers.
例如1到10,我希望输出为:4 1 3 8 2 5 6 7 9 10但是我不想重复数字。 How can I do that?
我怎样才能做到这一点?
我认为您需要的是-
randperm(10)
You can also use A = magic(4); 您也可以使用A = magic(4); B = A(A<=10);
B = A(A <= 10); B will give you required matrix.
B将给您所需的矩阵。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.