Summin elements on the rows of a specific page of a matrix

1 回表示 (過去 30 日間)
kevin cecere palazzo
kevin cecere palazzo 2019 年 7 月 30 日
回答済み: Guillaume 2019 年 7 月 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?

採用された回答

Guillaume
Guillaume 2019 年 7 月 30 日
B = sum(A(:, :, 1), 2); %sum 1st page of A across the columns (across the 2nd dimension)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by