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

1 次查看(过去 30 天)
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 个评论
surabhi sachdeva
surabhi sachdeva 2017-10-3
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.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2017-10-3
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 个评论

请先登录,再进行评论。

更多回答(1 个)

OCDER
OCDER 2017-10-3
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

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by