Filter löschen
Filter löschen

Cell Array Transform to Matrix as same sizes?

1 Ansicht (letzte 30 Tage)
delil codes
delil codes am 20 Apr. 2021
Kommentiert: delil codes am 20 Apr. 2021
I have a cell array like;
How can i transform it like matrix as same sizes?
There is any function for this?
  2 Kommentare
Rik
Rik am 20 Apr. 2021
What do you mean? What size and type do you want your output to be?
delil codes
delil codes am 20 Apr. 2021
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

Melden Sie sich an, um zu kommentieren.

Antworten (1)

delil codes
delil codes am 20 Apr. 2021
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

Kategorien

Mehr zu Structures finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by