フィルターのクリア

I have a function that takes an N X M array, A, and I want to take the sum of each column. The sum of the rows and sums of the two diagonals, the major diagonal first.

1 回表示 (過去 30 日間)
function [s] = multiSum(A)
s=sum(A(:,end))
end

採用された回答

Walter Roberson
Walter Roberson 2023 年 2 月 16 日
You can extract diagonals by using diag . And I see you already found sum . Be sure to read about the dim parameter of sum
  2 件のコメント
the cyclist
the cyclist 2023 年 2 月 16 日
I'm not convinced they "found" sum, as opposed to being given this function framework to adapt for a homework assignment. :-)
Joshua
Joshua 2023 年 2 月 16 日
for this homework I was given NO function framework to adapt. But thank you for the guide, I will update accordingly.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by