필터 지우기
필터 지우기

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
Azzi Abdelmalek
Azzi Abdelmalek 2017년 10월 3일
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 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
Walter Roberson
Walter Roberson 2017년 10월 4일
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 2017년 10월 4일
편집: surabhi sachdeva 2017년 10월 4일
thank you, sir
Kindly tell me a way to generate State transition rate matrix, please?

댓글을 달려면 로그인하십시오.

추가 답변 (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에서 Numeric Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by