看板 MATLAB 關於我們 聯絡資訊
假設目前有一個A矩陣長得這樣子 A[1 2 3 4 5 6] 我想要讓數值都重複3次變成 B[1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6] 在不運用迴圈的方式該怎麼做到呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.138.225.33 ※ 文章網址: https://www.ptt.cc/bbs/MATLAB/M.1524840318.A.245.html
LiamIssac: 試試看reshape 或是 bsxfun之類的函數 04/27 22:55
sppmg: reshape(repmat([1:6],3,1),[],1)' 04/28 02:39
sppmg: 作業? 04/28 02:40
YoursEver: kron(A, [1 1 1]), 原po可翻一下線性代數. 04/28 06:15
nova666666: repelem 04/28 11:52
thenewiPad2: 自己在研究matlab不清楚裡面的函數 所有上來發問了 04/28 12:27
thenewiPad2: 上面的大大提供的方法 都成功了 謝謝各位 04/28 12:28
sunev: 推repelem 04/28 18:25