Saving figure data statistics without using the GUI?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Ryan Takatsuka
2018-7-20
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!