gpt4 book ai didi

matlab - 在 matlab 中连接元胞数组的向量

转载 作者:太空宇宙 更新时间:2023-11-03 19:27:24 26 4
gpt4 key购买 nike

在 matlab 中,我有一个 4x5 元胞数组,其中每个元胞由一个 121x1 向量组成。

创建 3 维 4x5x121 矩阵避免 2 重循环的最简单方法是什么。

最佳答案

一种方式(不一定是最快的)

%# convert all arrays in the cell array inCell to 1x1x121
permCell = cellfun(@(x)permute(x,[3,2,1]),inCell,'uniformOutput',false);

%# catenate
array = cell2mat(permCell);

关于matlab - 在 matlab 中连接元胞数组的向量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13008730/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com