How to transpose a cell array ?
显示 更早的评论
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?
采纳的回答
更多回答(1 个)
the cyclist
2015-12-2
编辑:the cyclist
2015-12-2
To transpose the cell array itself:
C_transposed = C';
To transpose the matrices inside:
C_inside = cellfun(@transpose,C,'UniformOutput',false)
4 个评论
SUSHMA MB
2015-12-2
Murari Mandal
2016-11-4
It is working just fine.
Luke Aucoin
2020-9-24
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
2023-9-14
Thanks a lot!
类别
在 帮助中心 和 File Exchange 中查找有关 Numeric Types 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!