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.

采纳的回答

Ryan Takatsuka
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 个)

类别

Help CenterFile Exchange 中查找有关 Calendar 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by