Mean and Standard Deviation Calculator for MATLAB

Version 1.0.1 (1.54 KB) by Hassaan
Calculate mean and standard deviation of a dataset.
3 Downloads
Updated 16 Jan 2024

View License

% Note:
This function does not handle missing values (NaNs). It treats NaNs as regular numbers, which can affect the accuracy of the mean and standard deviation calculations.
% Example Usage of dataStatistics Function
% Creating a sample data matrix
sampleData = [1, 2, 3; 4, 5, 6; 7, 8, 9];
% Calling the dataStatistics function
[meanValue, stdValue] = dataStatistics(sampleData);
% Displaying the results
fprintf('The mean of the sample data is: %f\n', meanValue);
fprintf('The standard deviation of the sample data is: %f\n', stdValue);

Cite As

Hassaan (2024). Mean and Standard Deviation Calculator for MATLAB (https://www.mathworks.com/matlabcentral/fileexchange/157791-mean-and-standard-deviation-calculator-for-matlab), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2020a
Compatible with R2020b and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.1

Added example usage.

1.0.0