MATLAB在编程时,出现Undefined function or method 'randi' for input arguments of type 'double',

日期:2018-03-19 23:20:20 人气:3

MATLAB在编程时,出现Undefined function or method 'randi' for input arguments of type 'double',

这是因为Matlab的早期版本,如Matlab 2007不支持randi函数,解决办法: 编写randi函数的代码: function matrix=randi(num,a,b) vector=randsample(num,a*b); matrix=reshape(vector,a,b); end 将它保存为randi.m文件。
    A+
热门评论