cell2num

版本 1.1.0.0 (3.8 KB) 作者: Roberto Calandra
Convert N-dimensional cells of K-dimensional matrices to N*K matrices.
515.0 次下载
更新时间 2012/6/5

查看许可证

Neither previous CELL2NUM or CELL2MAT can deal with cells and matrices of arbitrary dimensions. Hence my submission.

This function convert a multidimensional cell INPUT composed of multidimensional matrices to a matrix OUTPUT. The only requirement is that all the matrices have the same dimensions.

Given N = size(INPUT) and K = size(INPUT{1}) the size of OUTPUT will be [N x K].

Example 1:
N => [2 3]
K => [4 3]
OUTPUT => [2 3 4 3]

Moreover it is possible to set parameters in order to eliminate eventual singleton dimensions or convert either N or K to equivalent vectors.

Example 2:
N => [1 3]
K => [4 1 2]
OUTPUT => [3 4 2]

Example 3:
(changing parameters)
N => [2 3]
K => [4 3]
OUTPUT => [6 4 3]

Example 4:
(using parameters)
N => [2 3]
K => [4 3]
OUTPUT => [2 3 12]

Example 5:
(using parameters)
N => [2 3]
K => [4 3]
OUTPUT => [6 12]

引用格式

Roberto Calandra (2024). cell2num (https://www.mathworks.com/matlabcentral/fileexchange/36968-cell2num), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2012a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Cell Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.1.0.0

Typo fixes

1.0.0.0