[問題] Martix reshape已回收
各位好,
假設目前有一矩陣,size 為 n x m,我想使用reshape將矩陣重新排列成
n:m = 1: 2
該怎樣使用reshape 來達成呢?
舉例:
假設一size 為 1 x 400的矩陣,我應該先將該矩陣resize至1 x 450
在將其化為一個 15 x 30 的矩陣
下面是我目前使用的方式,不知道有沒有什麼比較便捷的方式來達成?
input = randint(1,400,2,sum(clock)*7);
L = sqrt(length(input)/2);
if mod(L ,1) ~= 0;
L = L +1;
end %if
M = fix(L);
N = 2*M;
input = [input,zeros(1,M*N-length(input))];
dSource = reshape(input,M,N);
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.116.187.145
※ 編輯: jack555 來自: 140.116.187.145 (02/20 13:29)
推
02/21 01:50, , 1F
02/21 01:50, 1F