How do I reduce an {nxm(3x1)} cell to a an {nx{3xm}} cell?
2 次查看(过去 30 天)
显示 更早的评论
I apologize in advance if this seems trivial.
I have an {nxm(3x1)} object. That is, I have an n x m cells, each a 1x3 matrice. I'd like to reduce this so that I have {nx1} cells, each of which contain 1 {3xm} cell (or double, it doesn't matter) so that I can easily export the various 3xm matrices to n different 3xm arrays within an excel spreadsheet.
I've made various attempts at writing for loops, to no avail.
Any insight would be greatly appreciated.
Thanks.
EDIT: apparently I didn't look close enough at the cells, they are actually 1x3 doubles vice the original 3x1 I had stated.
0 个评论
采纳的回答
更多回答(1 个)
Zach Modig
2013-4-16
编辑:Zach Modig
2013-4-16
1 个评论
Iman Ansari
2013-4-16
Try this:
C=cellfun(@transpose,C,'UniformOutput', false)
New_Cell={};
for i=1:n
New_Cell{i,1}=cell2mat(C(i,:));
end
New_Cell
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!