Skip to content

Commit

Permalink
1st draft
Browse files Browse the repository at this point in the history
  • Loading branch information
jaderberg committed Apr 10, 2012
1 parent fadb728 commit 6342138
Show file tree
Hide file tree
Showing 32 changed files with 787 additions and 883 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
.idea/encodings.xml

.idea/.name

.DS_Store
32 changes: 31 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@

A simple interface to allow Python to call MATLAB functions.

Unlike other interfaces, MATLAB only has to start once. All communication is done over a TCP server (credit to Dr. Kroon).
Unlike other interfaces, MATLAB only has to start once. All communication is done over a TCP server (credit to D.Kroon University of Twente for hist TCP server).

## Usage

Initialize the Matlab class. You must pass in your matlab executable, e.g.
mlab = Matlab(matlab='/Applications/MATLAB_R2011a.app/bin/matlab')

By default the host is localhost and the port is 4000. This can be changed, e.g.
mlab = Matlab(matlab='/Applications/MATLAB_R2011a.app/bin/matlab',
host='192.168.0.1', port=5151)

You must then start the MATLAB server:
mlab.start()
which will return True once connected.

You can then run any local MATLAB function contained within a .m file of the same name. For example, to call the function jk in jk.m:
%% MATLAB
function lol = jk(args)
arg1 = args.arg1;
arg2 = args.arg2;
lol = arg1 + arg2;
end
by calling:
res = mlab.run('path/to/jk.m', {'arg1': 3, 'arg2', 5})
print res['result']
which will print 8.

You can shut down the MATLAB server by calling
mlab.stop()

NB: you can call MATLAB code before the server starts by adding code to the ./matlab/startup.m file.

Max Jaderberg 2012
34 changes: 0 additions & 34 deletions djmatlab/README

This file was deleted.

10 changes: 0 additions & 10 deletions djmatlab/__init__.py

This file was deleted.

77 changes: 0 additions & 77 deletions djmatlab/matlab/functions/JavaTcpServer.m

This file was deleted.

46 changes: 0 additions & 46 deletions djmatlab/matlab/functions/header2text.m

This file was deleted.

130 changes: 0 additions & 130 deletions djmatlab/matlab/functions/json2mat.m

This file was deleted.

14 changes: 0 additions & 14 deletions djmatlab/matlab/functions/make_bin_http_header.m

This file was deleted.

16 changes: 0 additions & 16 deletions djmatlab/matlab/functions/make_html_http_header.m

This file was deleted.

14 changes: 0 additions & 14 deletions djmatlab/matlab/functions/make_image_http_header.m

This file was deleted.

Loading

0 comments on commit 6342138

Please sign in to comment.