Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions pymatbridge/matlab/matlabserver.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,15 @@ function matlabserver(socket_address)
break;

case {'run_function'}
fhandle = str2func('pymat_feval');
resp = feval(fhandle, req);
resp = pymat_feval(req);
messenger('respond', resp);

case {'run_code'}
fhandle = str2func('pymat_eval');
resp = feval(fhandle, req);
resp = pymat_eval(req);
messenger('respond', resp);

case {'get_var'}
fhandle = str2func('pymat_get_variable');
resp = feval(fhandle, req);
resp = pymat_get_variable(req);
messenger('respond', resp);

otherwise
Expand Down
3 changes: 1 addition & 2 deletions pymatbridge/matlab/usrprog/demo_func.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
function res = test(args)
% demonstration function; formerly known as 'test.m'
function res = demo_func(args)

res = args.a + 1;
figure
Expand Down
2 changes: 1 addition & 1 deletion pymatbridge/matlab/usrprog/precision_divide.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function res = test_precision_divide(args)
function res = precision_divide(args)
% This function devides val1 by val2 and returns the result
res = args.val1 / args.val2;

Expand Down
2 changes: 1 addition & 1 deletion pymatbridge/matlab/usrprog/precision_multiply.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function res = test_precision_multiply(args)
function res = precision_multiply(args)
% This function returns the product of two arguments val1 and val2
res = args.val1 * args.val2;

Expand Down
2 changes: 1 addition & 1 deletion pymatbridge/matlab/usrprog/precision_pass.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function res = test_precision_pass(args)
function res = precision_pass(args)
% This function takes an argument val and simply return it

res = args.val;
Expand Down
2 changes: 1 addition & 1 deletion pymatbridge/matlab/usrprog/precision_sqrt.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function res = test_precision_sqrt(args)
function res = precision_sqrt(args)
% This function returns the square root of the value
res = sqrt(args.val);

Expand Down
2 changes: 1 addition & 1 deletion pymatbridge/matlab/usrprog/precision_sum.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function res = test_precision_sum(args)
function res = precision_sum(args)
% This function returns the sum of two arguments val1 and val2
res = args.val1 + args.val2;

Expand Down
13 changes: 6 additions & 7 deletions pymatbridge/matlab/util/pymat_eval.m
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
function json_response = web_eval(req);
%WEB_EVAL: Returns a json object of the result of calling the function
function json_response = pymat_eval(req);
% PYMAT_EVAL: Returns a json object of the result of calling the function
%
% json_response = WEB_EVAL(headers);
% json_response = WEB_EVAL(headers, config);
% json_response = pymat_eval(req);
%
% This allows you to run any matlab code. To be used with webserver.m.
% HTTP POST to /web_eval.m with the following parameters:
% This allows you to run any matlab code. req should be a struct with the
% following fields:
% code: a string which contains the code to be run in the matlab session
%
% Should return a json object containing the result
% Should return a json object containing the result.
%
% Based on Max Jaderberg's web_feval

Expand Down
2 changes: 1 addition & 1 deletion pymatbridge/matlab/util/pymat_feval.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% Max Jaderberg 2011

function json_response = matlab_feval(req)
function json_response = pymat_feval(req)

response.success = 'false';
field_names = fieldnames(req);
Expand Down
2 changes: 1 addition & 1 deletion pymatbridge/pymatbridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def is_connected(self):
return False

def is_function_processor_working(self):
result = self.run_func('%s/test_functions/test_sum.m' % MATLAB_FOLDER,
result = self.run_func('%s/usrprog/test_sum.m' % MATLAB_FOLDER,
{'echo': '%s: Function processor is working!' % self._program_name()})
return result['success'] == 'true'

Expand Down