Saving figure data statistics without using the GUI?
1 view (last 30 days)
Show older comments
Rose Lakatos
on 20 Jul 2018
Answered: Ryan Takatsuka
on 20 Jul 2018
Can I save all the xstats and ystats of a specific figure without doing it manually? I can currently do it by opening each figure, going to tools, data statistics and save to workspace on data1, data2,... There must be a better way than doing it manually.
0 Comments
Accepted Answer
Ryan Takatsuka
on 20 Jul 2018
You can create a function to collect this data for you. To create a structure with the same format as Tools -> Data Statistics from the figure menu, the following function can be used:
function data_stats = getDataStats(data)
% This function gets the data statistics that can be found in the figure menu:
% Tools -> Data Statistics
%
% SYNTAX
% stats = getDataStats(data)
%
% INPUTS
% data: a vector containing the data to get statistics for
%
% OUTPUTS
% data_stats: A structure containing the same information from 'Data Statistics'
data_stats.min = min(data);
data_stats.max = max(data);
data_stats.mean = mean(data);
data_stats.median = median(data);
data_stats.mode = mode(data);
data_stats.std = std(data);
data_stats.range = data_stats.max - data_stats.min;
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Data Import and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!