 while the sizes of all other dimensions remain the same.
% 
% |M = wmean(...,'all')| computes the weighted mean over all elements. (Requires Matlab
% R2018b or later.)
% 
% |M = wmean(...,'dim',dim)| returns the mean along dimension dim. For example, if |A| 
% is a matrix, then |wmean(A,weights,'dim',2)| is a column vector containing the
% weighted mean of each row.
% 
% |M = wmean(...,'nanflag')| specifies whether to include or omit |NaN| values from the 
% calculation for any of the previous syntaxes. |w