필터 지우기
필터 지우기

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 CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by