how to define a matrx type that each of its element is a matrix as well

1 回表示 (過去 30 日間)
xueqi
xueqi 2017 年 4 月 21 日
編集済み: Jan 2017 年 4 月 21 日
Hi, could you help me to achieve the following goal? I would like to define such a matrix, say M=[E1,E2,E3;E4,E5,E6]. And for each element, say E1=[1,2,3;3,2,1]?

回答 (2 件)

Star Strider
Star Strider 2017 年 4 月 21 日
See the documentation on Cell Arrays (link).

Jan
Jan 2017 年 4 月 21 日
編集済み: Jan 2017 年 4 月 21 日
A matrix cannot contain matrixes as elements. Eitehr use a cell array or a 3D-array, if all sub-matrices have the same size:
A = rand(2, 2);
B = rand(2, 2);
C = rand(2, 2);
D = cat(3, A, B, C)
Now D(:, :, i) is the corresponding "sub-matrix".

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by