This repository has been archived by the owner on Dec 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpm.m
74 lines (51 loc) · 1.43 KB
/
pm.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function pmi = pm(action)
% PM wrapper for projman.manager.instance()
%
% PM() returns the current projman.manager instance or creates a new one if it
% hasn't existed until called.
%
% PM('reset') removes the old projman.manager instance and creates a new one
% ultimately reading the project files anew.
%
% Outputs:
%
% M PROJMAN.MANAGER object
%
% See also:
% PROJMAN.MANAGER
%% File information
% Author: Philipp Tempel <[email protected]>
% Date: 2018-04-15
% Changelog:
% 2018-04-15
% * Initial release
%% Validate arguments
try
% PM()
% PM(ACTION)
narginchk(0, 1);
% PM(...)
% M = PM(...)
nargoutchk(0, 1);
if nargin < 1 || 1 ~= exist('action', 'var') || isempty(action)
action = 'instance';
end
validatestring(lower(action), {'', 'reset', 'instance'}, mfilename, 'action');
catch me
throwAsCaller(me);
end
%% Do your code magic here
% Persistent object
persistent pm_
% No object yet or create new?
if isempty(pm_) || strcmpi(action, 'reset')
pm_ = projman.manager();
end
%% Assign output quantities
% PMI = PM(...);
pmi = pm_;
end
%------------- END OF CODE --------------
% Please send suggestions for improvement of this file to the original author as
% can be found in the header Your contribution towards improving this function
% will be acknowledged in the "Changes" section of the header