如何在旧版的Matlab中使用表格? [英] How to use tables in older versions of Matlab?
问题描述
MATLAB 2010或更低版本中是否有任何函数以表格形式打印结果(例如:某些矩阵)?我从谷歌搜索中获得的只是一个table()
函数,该函数仅在MATLAB 2013或更高版本中有效.我的机器中装有MATLAB 2010,下载新版本不可行,因为它很大,所以我很着急.谢谢.
Is there any function in MATLAB 2010 or below versions to print a result (eg: Some matrices) in tabular form? All I got from googling was a table()
function that works only in MATLAB 2013 or above versions. I've got MATLAB 2010 in my machine and it's not practical to download a newer version as it is very large and I'm in a hurry. Thank you.
推荐答案
对于Matlab 2012及更低版本,
For Matlab versions 2012 and below,
可以使用printmat
can use printmat
printmat(yourMatrix, 'yourMatrix', 'ROW1 ROW2 ROW3 ROW4 ROW5', 'COLUMN1 COLUMN2 COLUMN3 COLUMN4 COLUMN5' );
或使用
dataset({yourMatrix 'COLUMN1','COLUMN2','COLUMN3','COLUMN4','COLUMN5'}, ...
'obsnames', {'ROW1','ROW2','ROW3','ROW4','ROW5'})
参考:显示具有行和列标签的矩阵
对于Matlab 2012及更高版本:
For Matlab versions 2012 and greater:
使用 array2table 来转换数组到表中.
Use array2table, which converts an array into a table.
示例:
A = [1 4 7; 2 5 8; 3 6 9];
T = array2table(A)
T =
A1 A2 A3
__ __ __
1 4 7
2 5 8
3 6 9
这篇关于如何在旧版的Matlab中使用表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!