Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
MATLAB には、次のようなデータがあります。
5 7 1 5 8 2 5 9 3 6 7 3 6 8 3 6 9 2
ここで、各列は配列です (例: x = [5; 5; 5; 6; 6; 6])。次の方法でデータを行列形式に入れたい:
x = [5; 5; 5; 6; 6; 6]
7 8 9 5 1 2 3 6 3 3 2
助言がありますか?
これはあなたが必要とするものですか?
>> x =[5 7 1 5 8 2 5 9 3 6 7 3 6 8 3 6 9 2]; >> rowlabels = unique(x(:,1)) rowlabels = 5 6 >> collabels = unique(x(:,2))' collabels = 7 8 9 >> data = reshape(x(:,3),numel(collabels),numel(rowlabels))' data = 1 2 3 3 3 2