Error using sum function

조회 수: 7 (최근 30일)
Nour Aburaed
Nour Aburaed 2018년 12월 26일
편집: Bruno Luong 2023년 11월 25일
I have a 26x26 matrix 'A' of type double. I want to sum all of its elements using S = sum(A, 'all').
I keep getting the following error:
Error using sum
Invalid option. Option must be 'double', 'native', 'default', 'omitnan' or 'includenan'.
Can someone help me with this? My matrix is of the correct type, so I am not sure what's wrong.
  댓글 수: 12
DGM
DGM 2023년 11월 25일
Ah.
Paul
Paul 2023년 11월 25일
편집: Bruno Luong 2023년 11월 25일
I assume sum(X,'all') is implemented as sum(X(:)) at the intermediate interface level before the sum hoerachy and low-level CPU instruction occurs, so I think yes, they should return the same result.

댓글을 달려면 로그인하십시오.

채택된 답변

madhan ravi
madhan ravi 2018년 12월 26일
편집: madhan ravi 2018년 12월 26일
sum(A(:)) % if it doesn't work either upload your matrix as .mat file
  댓글 수: 9
madhan ravi
madhan ravi 2018년 12월 26일
But sir Image Analyst I’m using student version too , it works in my case though.
Steven Lord
Steven Lord 2018년 12월 26일
Image Analyst: clicking on the "Buy MATLAB and Simulink Student Suite" button on this page brings up the store page for the Student Version of release R2018b.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by