-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathis_deployed.m
48 lines (38 loc) · 996 Bytes
/
is_deployed.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
function filename = is_deployed( varargin )
disp('Checking number of input arguments')
if length(varargin) == 1
text_file = varargin{1};
else
error('Deployed function takes only 1 argument. Exiting method.');
return
end
disp('Checking existence of input file')
[filepath, name, ext] = fileparts(text_file);
if ~exist(text_file, 'file')
warning('Input file does not exist. Exiting method.');
return
end
disp(['Attempting to read input file ' text_file]);
fid = fopen(text_file, 'r' );
disp('Evaluating lines from input file');
while ~feof(fid)
line = fgets(fid);
disp(line);
try
eval(line);
catch err
disp('Unable to parse line');
getReport(err)
return
end
end
disp('Closing input file')
fclose(fid);
if ~exist('options', 'var')
options = {};
end
%save all the params to a temp file to be loaded back in main function
[~,guid] = fileparts(tempname);
filename = strcat('/tmp/', guid, '.mat');
save(filename);
end