How to display the elements of a matrix D as an input for the next matrix 729x729 rows and columns?

1 vue (au cours des 30 derniers jours)
I want the matrix elements to be inputted in the rows as well as in the columns of the matrix so as to get 729x729 matrix.
I am attaching the 729x6 matrix whose elements I want to show as input in the rows and columns.
Please help me generate the 729x729 matrix this way using MATLAB.
regards
surabhi
  2 commentaires
Azzi Abdelmalek
Azzi Abdelmalek le 3 Oct 2017
Your question is not clear. you have a 729x6 matrix, if you want a 729x729 you have to define the missing data
surabhi sachdeva
surabhi sachdeva le 3 Oct 2017
Actually, I want to take the 729 elements of the matrix as an input for the new 729x729 matrix.
Means the elements of the old matrix to be the values of rows and columns in the new matrix.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 3 Oct 2017
As discussed in https://www.mathworks.com/matlabcentral/answers/359051-how-to-display-729-double-input-arguments-in-tabular-form-to-get-729-729-matrix#comment_489118 it is important information that you are using R2013a and that you do have access to the Statistics toolbox. I asked you there whether you needed this for display purposes or only for computation purposes, and I showed you there how best to do this for computation purposes.
For display purposes, you will need a display that is a minimum of 36450 pixels wide, assuming that you are willing to accept 8 pixels per character including intra-character gap (narrower characters are hard to read; 6 pixels per character is considered barely readable.) This calculation assumes a 2 pixel gap between labels, which is quite tight.
To draw this, you would text() every character into place, having set the FontSize property to be quite small, and having set a monospaced font. To avoid having space take up a full character position, you would have to text() every column individually, but at least you can do an entire column at a time instead of having to do each item individually.
If someone is imposing on you a need to use a datastructure that looks sort of like this when it displays, then in R2007a to R2013a with Statistics Toolbox, you would use
H = cellstr( strcat('T', char('0' + fullfact([3 3 3 3 3 3])-1 ) ) );
emptyvals = repmat({''}, length(H), length(H));
YourTable = cell2dataset(emptyvals, 'ReadVarNames', false, 'ReadObsNames', false, 'VarNames', H, 'ObsNames', H);
  5 commentaires
Walter Roberson
Walter Roberson le 4 Oct 2017
I already showed you in the previous Question how to convert the 729 x 6 to 729 x 729: use the 12 dimensional array.
surabhi sachdeva
surabhi sachdeva le 4 Oct 2017
Modifié(e) : surabhi sachdeva le 4 Oct 2017
thank you, sir
Kindly tell me a way to generate State transition rate matrix, please?

Connectez-vous pour commenter.

Plus de réponses (1)

OCDER
OCDER le 3 Oct 2017
Maybe you can make your own data structure and get/set methods to access them by 6-tuple char:
Tuple = fullfact([3 3 3 3 3 3]) - 1;
List = cell(729, 1);
for j = 1:numel(List)
List{j} = sprintf('%d%d%d%d%d%d', Tuple(j, :));
end
List = %Your list of 6-tuple names, cell array of char. Your row and column names.
729×1 cell array
'000000'
'100000'
'200000'
'010000'
'110000'
'210000'
....
M = zeros(length(List)); %Your 729x729 matrix
M = setM(M, List, '000000', '100000', 2) %To access a row and col in M by 6-tuple string and set to 2
M =
0 2 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
V = getM(M, List, '000000', '100000') %to access M based on a row and col 6-tuple strings
V =
2
But you'll need these 2 functions:
%Set a value in M based on tuple
function M = setM(M, List, RowStr, ColStr, Value)
Row = contains(List, RowStr);
Col = contains(List, ColStr);
M(Row, Col) = Value;
end
%Get a value in M based on tuple
function Value = getM(M, List, RowStr, ColStr)
Row = contains(List, RowStr);
Col = contains(List, ColStr);
Value = M(Row, Col);
end

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by