0
我想用randperm
編寫一個叫做matchUp
的MATLAB函數,它返回一個n×2矩陣。如果輸入是奇數,則該函數應該退出並顯示解釋性消息。如何用randperm生成n×2矩陣
這裏是對於n = 24的樣本輸出:
matchUp(24)
ans =
6 18
19 10
20 4
5 3
11 15
23 12
13 1
21 24
2 22
9 16
7 17
14 8
然而,當我做randperm(24)
我得到的載體。我如何繼續?
這一個似乎工作我只是改變了2的nrows到12.謝謝! – sneakatone