This repository has been archived by the owner on Dec 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprtStat.m
58 lines (45 loc) · 1.56 KB
/
prtStat.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
%% prtStat
% Print parameter or stastistic of selected entries names and values
%%
function [nm, val, units, label] = prtStat(taxa, var, in)
% created by Bas Kooijman 2017/08/20, modified 2017/11/24, 2017/12/14
%% Syntax
% [nm, val, units, label] = <../prtStat.m *prtStat*>(taxa, var, in)
%% Description
% Print parameter or statistic values for selected entries to screen.
%
% Input:
%
% * taxa: cell-string with taxa
% * var: character string with parameter or statistic
% * in: optional scalar with indicator for ordering increasing (1), decreasing (-1), no printing to screen (0); default: no ordering and printing to screen (empty)
%
% Output
%
% * nm: n-cellstring with names of entries
% * val: n-vector with values for parameter or statistic
% * units: charactore string with units
% * label: charactore string with label
%% Remarks
% See <pedigreet.html *pedigree*> for lists with tree
%% Example of use
% prtStat({'Paridae','Cyprinidae'}, 'p_M');
[val nm units label] = read_allStat(var);
sel = select_01(taxa);
if ~(length(val) == length(sel))
fprintf('Warning from prtStat: entries in allStart do not correspond with select\n');
end
nm = nm(sel); val = val(sel);
if ~exist('in', 'var') % yes or no sorting
in = NaN;
end
switch in
case -1
[val i] = sort(val, 'descend'); nm = nm(i);
case 1
[val i] = sort(val, 'ascend'); nm = nm(i);
end
units = units{1}; label = label{1};
if ~(in == 0)
printpar(nm, val, [], [label, ': ', units])
end