具有不同维度的matlab矩阵(matlab matrix with non-same dimension)

我有矩阵C01 <0>,矩阵C02 <50x1800 double>,矩阵C3 <50x34 double>我需要将它转换为一个C(i),使用这样的表达式C(1)= C01,C(2) )= C02。

i have matrix C01 <0>, matrix C02 <50x1800 double>, matrix C3 <50x34 double> and i need to transform it to one thing C(i), for using expression like this C(1) = C01, C(2) = C02.

最满意答案

您需要使用单元格数组并将单个元素引用为C{1} = C01 , C{2} = C02等。

您也可以将单元格数组创建为C = {C01, C02, C03};

请注意,您仍然可以对单元格数组使用C(1)语法,但此语句将不返回原始数字矩阵,而是将矩阵封装到具有一个元素的单元格数组中。

You need to use cell array and refer individual elements as C{1} = C01, C{2} = C02, etc.

You can also create the cell array as C = {C01, C02, C03};

Notice that you still can use C(1) syntax for cell array, but this statement will return not the original numeric matrix, but the matrix encapsulated into a cell array with one element.

更多推荐