How to display 729 'double' input arguments in tabular form? to get 729*729 matrix
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
surabhi sachdeva
el 29 de Sept. de 2017
Comentada: Walter Roberson
el 1 de Oct. de 2017
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 comentarios
Walter Roberson
el 30 de Sept. de 2017
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
el 1 de Oct. de 2017
Editada: Stephen23
el 1 de Oct. de 2017
@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"
Respuesta aceptada
Walter Roberson
el 1 de Oct. de 2017
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 comentarios
Walter Roberson
el 1 de Oct. de 2017
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!