when I have running the below code I have got error message
古いコメントを表示
when I have running the below code I got the following message
*??? Error using ==> randperm
Too many input arguments.*
The code is
locations_per_FACT = 4;
number_of_types = 4;
number_of_locations = 13;
population_size = 100;
for K = population_size : -1 : 1
FACT(K) = struct('location', randperm(number_of_locations,locations_per_FACT), 'type', randi(number_of_types,1,locations_per_FACT), 'rate', rand(1,locations_per_FACT));
end
1 件のコメント
Geoff Hayes
2015 年 10 月 17 日
omer - this error message is telling you that are trying to pass too many input arguments into the http://www.mathworks.com/help/matlab/ref/randperm.html function. I can run the above code without any problems (using R2014a) so perhaps your version of MATLAB doesn't support the two arguments. In the Command Window, type
help randperm
What does the help show you? Does it show that you can pass one or two arguments? My help shows
randperm Random permutation.
P = randperm(N) returns a vector containing a random permutation of the
integers 1:N. For example, randperm(6) might be [2 4 5 6 1 3].
P = randperm(N,K) returns a row vector containing K unique integers
selected randomly from 1:N. For example, randperm(6,3) might be [4 2 5].
etc.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Mathematics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!