Cell Array Transform to Matrix as same sizes?

1 次查看(过去 30 天)
I have a cell array like;
How can i transform it like matrix as same sizes?
There is any function for this?
  2 个评论
Rik
Rik 2021-4-20
What do you mean? What size and type do you want your output to be?
delil codes
delil codes 2021-4-20
eg: 2x3 cell;
6x6 sym 6x18 sym 6x12 sym
6x6 sym 6x18 sym 6x12 sym
to
12x36 matrix
i did it :)
lineStart = 1;
[lines,columns] = size(rectangularCell);
for i = 1:lines
columnStart =1;
for j = 1:columns
[xSizes, ySizes] = size(rectangularCell{i,j});
rectangularMatrix...
(lineStart:lineStart+xSizes-1,columnStart:columnStart+ySizes-1) ...
= rectangularCell{i,j};
columnStart = columnStart + ySizes;
end
lineStart = lineStart + xSizes;
end

请先登录,再进行评论。

回答(1 个)

delil codes
delil codes 2021-4-20
Thx guys i did it, you can use this for rectangular cells to rectangular matrix. If your cell have cells lıke;
eg: 2x3 cell;
6x6 sym 6x18 sym 6x12 sym
6x6 sym 6x18 sym 6x12 sym
to
12x36 matrix
lineStart = 1;
[lines,columns] = size(rectangularCell);
for i = 1:lines
columnStart =1;
for j = 1:columns
[xSizes, ySizes] = size(rectangularCell{i,j});
rectangularMatrix...
(lineStart:lineStart+xSizes-1,columnStart:columnStart+ySizes-1) ...
= rectangularCell{i,j};
columnStart = columnStart + ySizes;
end
lineStart = lineStart + xSizes;
end

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by