フィルターのクリア

Cell Array Transform to Matrix as same sizes?

1 回表示 (過去 30 日間)
delil codes
delil codes 2021 年 4 月 20 日
コメント済み: delil codes 2021 年 4 月 20 日
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 Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by