How to transpose a cell array ?

257 Ansichten (letzte 30 Tage)
SUSHMA MB
SUSHMA MB am 2 Dez. 2015
Kommentiert: Yuri am 14 Sep. 2023
Each cell in the cell array contains a matrix, e.g.,
Suppose the cell array is
[8x1] cell
Inside which their are some matrix like
[6x2] double
[7x2] double
[6x2] double
[7x2] double
[6x2] double
[7x2] double
[6x2] double
[7x2] double
Now i want to transpose the cell array into
[1x8] cell
How to do it?

Akzeptierte Antwort

SUSHMA MB
SUSHMA MB am 2 Dez. 2015
reshape command works for this example well. For poly as the name of the cell array,
polyre = reshape(poly,[1 8]);

Weitere Antworten (1)

the cyclist
the cyclist am 2 Dez. 2015
Bearbeitet: the cyclist am 2 Dez. 2015
To transpose the cell array itself:
C_transposed = C';
To transpose the matrices inside:
C_inside = cellfun(@transpose,C,'UniformOutput',false)
  4 Kommentare
Luke Aucoin
Luke Aucoin am 24 Sep. 2020
I used C_transposed = C' to transform a row array of character strings into a column array of the same strings. Thanks @the cyclist.
Yuri
Yuri am 14 Sep. 2023
Thanks a lot!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Creating and Concatenating Matrices 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