Multidimensional Arrays of different size

83 ビュー (過去 30 日間)
arnaud ensberg
arnaud ensberg 2015 年 4 月 9 日
コメント済み: arnaud ensberg 2015 年 4 月 12 日
Hello
can i creat a Multidimensional Arrays of matrix of different size, like this :
mulat(:,:,1)=[1 3;3 5;5 6]
mulat(:,:,2)=[1 3;3 5;5 6;2 3]
??? Subscripted assignment dimension mismatch.% code

採用された回答

Michael
Michael 2015 年 4 月 9 日
Not like that. The best solution will depend on your goal. One option is to store the arrays in a cell array.
mulat={[1 3;3 5;5 6]}
mulat{2}=[1 3;3 5;5 6;2 3]
  1 件のコメント
arnaud ensberg
arnaud ensberg 2015 年 4 月 12 日
please what is the difference between mulat{2} and mulat (2) ?

サインインしてコメントする。

その他の回答 (1 件)

Jan
Jan 2015 年 4 月 12 日
編集済み: Jan 2015 年 4 月 12 日
Numerical arrays contain numerical scalars as elements. Therefore it is impossible to store a different number of elements in different slices of the same dimensions. This is simply the definition of a numerical array.
Using the curly braces { and } you create a cell array . These arrays can contain variables of any type and dimensions as elements. Please read the documentation: doc cell
  1 件のコメント
arnaud ensberg
arnaud ensberg 2015 年 4 月 12 日
thank you Jan simon ,it is very clear now.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by