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