-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotEN.m
50 lines (43 loc) · 1.19 KB
/
plotEN.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
function h = plotEN(varargin)
% function plotEN(x, EN_y, args for errorbar)
% or
% function plotEN(EN_y, args for errorbar)
%
% x - (npoint,nseries) x location of the data
% EN_y - ErrorNum(npoint, nseries) Y data as ErrorNum.
% for the rest, you can use optional arguments for errorbar.
% look at the manual of it.
%
% Returns:
% nothing
%
% Description:
% Handy function to plot ErrorNum
%
% Example:
% >> y = ErrorNum([1, 2, 1, 2], [0.2, 0.2, 0.3, 0.3]);
% >> plotEN(y)
% >> plotEN([1, 2, 5, 6], y, 'ro')
%
% Requires:
% ErrorNum.m
%
% Author: Shinya Ito
% University of California, Santa Cruz ([email protected])
%
% Created: 9/21/2018
% Modified: 9/21/2018, this manual is added
% function plotEN(varargin)
% a function to plot ErrorNum values.
if isa(varargin{1}, 'ErrorNum') % first one is ErorrNum
% just make up the first argment for this function and call again
d = varargin{1};
if isvector(d)
x = 1:length(d);
else
x = repmat((1:length(d))', 1, size(d, 2));
end
h = plotEN(x, varargin{:});
elseif isa(varargin{2}, 'ErrorNum')
h = errorbar(varargin{1}, varargin{2}.value, varargin{2}.err, varargin{3:end});
end