-
Notifications
You must be signed in to change notification settings - Fork 0
/
call_function.m
30 lines (28 loc) · 1.06 KB
/
call_function.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
function success = call_function(input_string)
% calls the function in this folder with argument in the format function;argument
% and update the appropriate logs
try
inputs = strsplit(input_string,';');
script_name = inputs{1};
folder_name = inputs{2};
job_ID = get_job_ID(folder_name, script_name);
disp(script_name);
disp(folder_name);
disp(job_ID);
%update the logs before starting
update_logs(folder_name,script_name,'RUNNING',job_ID,'Within_MATLAB');
function_handle = str2func(script_name);
%run the function
% profile on
function_handle(folder_name);
% profile off
% profsave(profile('info'),folder_name)
success = true;
%update the logs after completing
update_logs(folder_name,script_name,'COMPLETE',job_ID,'Within_MATLAB');
catch ME
success = false;
%update the logs after completing
update_logs(folder_name,script_name,'ERROR',job_ID,regexprep(ME.message,'\r\n|\n|\r',' '));
end
end