btw, if I use eml.extrinsic to execute it, I understand that the operation is performed externally, but, it affect my code when this is done?
replace the function "randperm" into code from embedded block SIMULINK
1 回表示 (過去 30 日間)
古いコメントを表示
hi, I need to generate a c code from the next code wrote on an embedded editor from embedded block from simulink, but randperm is not supported by code generation, is there some way to do it?
thanks for you support
Size = 100
n = 50
pop = zeros(Size,n);
pop(1,:) = (1:n);
for k = 2:popSize
pop(k,:) = randperm(n);
end
採用された回答
Jan
2012 年 11 月 20 日
randperm() is actually:
[~, p] = sort(rand(1,n))
Does this work in code generation?
In the current Matlab version, randperm uses the smarter Fisher-Yates-Shuffle, when 2 inputs are used. Would a corresponding C-Mex function work: FEX: Shuffle ?
2 件のコメント
Jan
2012 年 11 月 21 日
Another useful implementation of the Fisher-Yates-Shuffle in pure Matlab: http://www.mathworks.com/matlabcentral/fileexchange/30101-rpg-lab
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Deployment, Integration, and Supported Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!