Summin elements on the rows of a specific page of a matrix
1 次查看(过去 30 天)
显示 更早的评论
If I have a matrix A(n,m,2) i.e. a two pages matrix, and a vector B(n,1), how should I write the expression for the j-th element of b, if I want B to contain the sum of the elements of the rows of the first page of A?
0 个评论
采纳的回答
Guillaume
2019-7-30
B = sum(A(:, :, 1), 2); %sum 1st page of A across the columns (across the 2nd dimension)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!