-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathParameter.m
56 lines (48 loc) · 1.42 KB
/
Parameter.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
classdef Parameter < handle
properties (Access = public)
tag
value = 0
lower = -realmax
upper = realmax
fixed = false
end
properties (Access = private)
type = 'par'
end
methods (Access = public)
function obj = Parameter(tag, val, lb, ub, fixed)
if nargin < 1
error('Parameter needs a "tag".')
end
obj.tag = tag;
if nargin >= 2 && ~isempty(val)
obj.value = val;
end
if nargin >= 3 && ~isempty(lb)
obj.lower = lb;
end
if nargin >= 4 && ~isempty(ub)
obj.upper = ub;
end
if nargin == 5 && ~isempty(fixed)
obj.fixed = fixed;
end
end
function Show(obj)
if obj.fixed
fx = 'yes';
else
fx = 'no';
end
fprintf('\n\t Class: %s\n', mfilename)
fprintf('\t Tag: %s\n', obj.tag)
fprintf('\t Value: %2.4e\n', obj.value)
fprintf('\t Lower: %2.4e\n', obj.lower)
fprintf('\t Upper: %2.4e\n', obj.upper)
fprintf('\t Fixed: %s\n', fx)
end
function type = getType(obj)
type = obj.type;
end
end
end