?? getpermute.m
字號(hào):
function [out_permute] = getPermute(in_values, in_first, in_jobCount)
% 輸入:
% in_values: 需排列的元素,(1 × valueCount)維
% 輸出:
% out_permute: 得到的全排列,(perCount × valueCount)維
out_permute = [];
valueCount = size(in_values, 2);
if (valueCount == in_jobCount-1)
strcat('開始枚舉 ' , num2str(in_first), '...')
end
if (valueCount == 1) % 遞歸結(jié)束
out_permute = in_values;
else
for (iValue = 1: valueCount)
firstVal = in_values(1, iValue);
newValues = in_values;
newValues(:, iValue) = [];
newPermute = getPermute(newValues, firstVal, in_jobCount);
perCount = size(newPermute, 1);
curPermute = [ones(perCount, 1) * firstVal, newPermute];
out_permute = [out_permute; curPermute];
end
end
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -