如何转置MATLAB表? [英] How to transpose a MATLAB table?
本文介绍了如何转置MATLAB表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何翻转表格,使VariableNames
变为RowNames
How can I flip a table such that VariableNames
becomes RowNames
即
m0 m1 m10 m11 m12 m13 m14 m2 m3 m4 m5 m6 m7 m8 m9
________ _______ _______ _______ _______ _______ _______ _______ _______ _______ ________ ________ _______ _______ _______
0.096898 0.11567 0.23266 0.11393 0.51438 0.51438 0.51438 0.42039 0.11543 0.11024 0.060229 0.086558 0.11542 0.11537 0.43305
成为
Chisq
_______
m0 0.096898
m1 0.11567
m2 ...
... ...
推荐答案
您需要先将表转换为数组,然后再旋转并将其转换回表:
you need to first convert your table to an Array before rotating and converting it back into a table:
YourArray = table2array(YourTable);
YourNewTable = array2table(YourArray.');
YourNewTable.Properties.RowNames = YourTable.Properties.VariableNames;
您也可以尝试rot90(YourTable)
看看会发生什么,但是我不确定它是否会执行相同操作(我认为这是那些令人误解的名称之一)
You can also try rot90(YourTable)
and see what happens, but I'm not sure it does the same (I think it is one of those misleading names)
这篇关于如何转置MATLAB表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文