sum(___, outtype)
sum(___, outtype) is used to return the sum with a specified data type, using any of the input arguments in the previous syntaxes. Here the outtype can be ‘default’, ‘double’, or ‘native’.
Example:
Matlab
% MATLAB code for sum(A,'outtype') % Creating a vector of 32-Obit integers A = int32(1:5); % Calculating the above vector's % elements by specifying the output type as native Sum = sum(A, 'native' ) |
Output:
Sum = 15
How to find sum of elements of an array in MATLAB?
This article will discuss the “Finding sum of elements of an array” in MATLAB that can be done using multiple approaches which are illustrated below.