question regarding sum(m,3) command
9 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
その他の回答 (1 件)
Jan
2022 年 12 月 13 日
編集済み: Jan
2022 年 12 月 13 日
Actually a sum over a 3D array along the 3rd dimension replies a [M x N x 1] array, as summing over the 2nd dimension creates a [M x 1 X P] array. But Matlab ignores trailing singelton dimensions, except it is the 2nd dimension of a matrix (known as "column vector").
You can even access these virtual dimensions:
X = [1, 2; 3, 4]
X(1, 2, 1)
X(2, 2, 1, 1, 1, 1, 1)
There have been some inconsistencies in R2009a, which let trailing singelton dimensions exist for some functions implemented a C-mex. This did not cause bugs, but the ndims command counted this virtual dimensions also. In modern Matlab version, this feature is supported consequently as far as I know.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!