Summing elements of an array
1 次查看(过去 30 天)
显示 更早的评论
Hi, so for example I have P such that: P =
3×1 cell array
[1]
[2]
[3].
The matrix P can be a n x 1 cell array, where n is any positive integer, and can only hold numbers. Ive tried to sum these numbers using sum(P) but keep getting the error ' Undefined function 'sum' for input arguments of type 'cell'. '. Any ideas on how I could do this? thank-you.
1 个评论
Stephen23
2018-4-13
@Gian Carpinelli: why are you storing numeric data in a cell array? It would be simpler to store it in a numeric array.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!