필터 지우기
필터 지우기

How to get sum of columns even if the matrix is a row vector?

조회 수: 1 (최근 30일)
Mohammad Haghighat
Mohammad Haghighat 2016년 10월 4일
편집: Matt J 2016년 10월 4일
I'd like to get the sum of columns in a matrix, but when the matrix has only one row, the SUM function gives the sum of all elements in the row. How can I skip that? The ideal solution will return the row vector itself.

채택된 답변

Matt J
Matt J 2016년 10월 4일
편집: Matt J 2016년 10월 4일
sum(theMatrix,1)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by