Borrar filtros
Borrar filtros

How to display 729 'double' input arguments in tabular form? to get 729*729 matrix

4 visualizaciones (últimos 30 días)
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
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
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"
It is not clear what this means. Are you wanting a symmetric matrix of some kind?

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
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
surabhi sachdeva
surabhi sachdeva el 1 de Oct. de 2017
Editada: surabhi sachdeva el 1 de Oct. de 2017
Sir, I am using R2013a version of MATLAB. Yes, I have access to the statistical toolbox.
Actually, sir in my case I have been given with certain transitions and not all. Even, I didn't have access to complete state-space. So, first I generated the complete state space, from where I got a total of 729 elements and I was given with only seven states.
So, my aim is to generate the complete state space along with transition rates.For which I have to have access to the complete 729x729 matrix.
Then, I have to filter the elements based on input conditions.
And, finally, I have to apply state transition rules to the state space matrix generated.
Not only display, I need an actual data structure.
Kindly help me out. I have attached a screenshot to show what I am expecting through this query.
Please suggest
Walter Roberson
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by