How to display 729 'double' input arguments in tabular form? to get 729*729 matrix
1 次查看(过去 30 天)
显示 更早的评论
I have a list of 729 elements, each element being 6-tuple. I want to display this list in the form of a table. Elements in rows is same as elements in columns.
4 个评论
Walter Roberson
2017-9-30
I do not understand what the 729 x 729 array is to look like. Are you saying that it needs to be a symmetric matrix? Is it certain that a symmetric matrix with the required properties can be created?
Stephen23
2017-10-1
编辑:Stephen23
2017-10-1
@surabhi sachdeva: MATLAB does not have any data type/class named "tuple", so it is not clear what you expect to happen. The input you supply to fullfact is a 1x6 double array. To learn the basic data types you should do the Introductory Tutorials, which are highly recommended for all beginners:
" I want to generate a 729x729 matrix..."
The output you get from fullfact is a 729x6 matrix. This is correct for the values that have provided. It is not clear what you want to do with this 729x6 matrix, nor why you expect to be able to turn it into a 729x729 matrix.
"...being each element in row and column similar to one another"
采纳的回答
Walter Roberson
2017-10-1
H = cellstr( strcat('T', char('0' + fullfact([3 3 3 3 3 3])-1 ) ) );
emptyvals = repmat({''}, length(H), length(H));
YourTable = cell2table(emptyvals, 'VariableNames', H, 'RowNames', H);
Now YourTable is a 729 x 729 table in which each entry is an empty character vector (that you can then overwrite with appropriate content.) The columns are labeled, with
T000000 T100000 T200000 T010000 T110000 etc
and so are the rows.
In MATLAB, the column names for table() objects must be valid variable names so it is not possible to use pure numbers, but you could change the T to any alphabetic letter you wanted.
4 个评论
Walter Roberson
2017-10-1
The easiest approach is to use a matrix
M = zeros(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3);
which you would index as
M(Si, Sj, Sk, Sl, Sm, Sn, Di, Dj, Dk, Dl, Dm, Dn)
where the S* variables are "source" (where you are starting from) and the D* variables are "destination" (where you are going to)
Just remember that indices need to start from 1, so if you are working with 0, 1, 2 values then add 1 before using those as indices.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!