我需要從串列中隨機選擇名稱并將它們隨機放入定義數量的組中。例如,我在一個串列中有 20 個名字,我希望我的代碼隨機選擇一個名字并將它們放入 4 個組之一,直到串列末尾。在代碼的最后,我想輸出每個生成的組或團隊的名稱。
這是我到目前為止所擁有的,但它不起作用。
data = readtable("NameList (2).xlsx");
%Check and make sure the script is accurately pulling names
Names = (data{:,1}); disp(Names)
%Arranging and Organizing Data
number_of_people = numel(data);
%Scramble array
s= number_of_people(randperm(length(number_of_people)))
number_of_groups = 4;
divisions = sort(randperm(number_of_people-1, number_of_groups-1) 1, 'ascend')
divisions = [0, divisions, number_of_people]
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/410396.html
標籤:
上一篇:平鋪布局的中心對齊
