matlab建立一个3×4随机整数矩阵a,元素范围为1到99,最常用的方法是rand函数。
a=floor(rand(3,4)*99)+1
其次,如果你需要整数不重复,可以使用randperm,代码稍微多了一句:
a=randperm(99);
a=reshape(a(1:12),3,4)