Error using sum function
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nour Aburaed
am 26 Dez. 2018
Bearbeitet: Bruno Luong
am 25 Nov. 2023
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 Kommentare
Paul
am 25 Nov. 2023
Bearbeitet: Bruno Luong
am 25 Nov. 2023
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.
Akzeptierte Antwort
madhan ravi
am 26 Dez. 2018
Bearbeitet: madhan ravi
am 26 Dez. 2018
sum(A(:)) % if it doesn't work either upload your matrix as .mat file
9 Kommentare
madhan ravi
am 26 Dez. 2018
But sir Image Analyst I’m using student version too , it works in my case though.
Steven Lord
am 26 Dez. 2018
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!