Skip to content

Commit 6342138

Browse files
committed
1st draft
1 parent fadb728 commit 6342138

32 files changed

+787
-883
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212
.idea/encodings.xml
1313

1414
.idea/.name
15+
16+
.DS_Store

README.markdown

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,36 @@
22

33
A simple interface to allow Python to call MATLAB functions.
44

5-
Unlike other interfaces, MATLAB only has to start once. All communication is done over a TCP server (credit to Dr. Kroon).
5+
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).
6+
7+
## Usage
8+
9+
Initialize the Matlab class. You must pass in your matlab executable, e.g.
10+
mlab = Matlab(matlab='/Applications/MATLAB_R2011a.app/bin/matlab')
11+
12+
By default the host is localhost and the port is 4000. This can be changed, e.g.
13+
mlab = Matlab(matlab='/Applications/MATLAB_R2011a.app/bin/matlab',
14+
host='192.168.0.1', port=5151)
15+
16+
You must then start the MATLAB server:
17+
mlab.start()
18+
which will return True once connected.
19+
20+
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:
21+
%% MATLAB
22+
function lol = jk(args)
23+
arg1 = args.arg1;
24+
arg2 = args.arg2;
25+
lol = arg1 + arg2;
26+
end
27+
by calling:
28+
res = mlab.run('path/to/jk.m', {'arg1': 3, 'arg2', 5})
29+
print res['result']
30+
which will print 8.
31+
32+
You can shut down the MATLAB server by calling
33+
mlab.stop()
34+
35+
NB: you can call MATLAB code before the server starts by adding code to the ./matlab/startup.m file.
636

737
Max Jaderberg 2012

djmatlab/README

Lines changed: 0 additions & 34 deletions
This file was deleted.

djmatlab/__init__.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

djmatlab/matlab/functions/JavaTcpServer.m

Lines changed: 0 additions & 77 deletions
This file was deleted.

djmatlab/matlab/functions/header2text.m

Lines changed: 0 additions & 46 deletions
This file was deleted.

djmatlab/matlab/functions/json2mat.m

Lines changed: 0 additions & 130 deletions
This file was deleted.

djmatlab/matlab/functions/make_bin_http_header.m

Lines changed: 0 additions & 14 deletions
This file was deleted.

djmatlab/matlab/functions/make_html_http_header.m

Lines changed: 0 additions & 16 deletions
This file was deleted.

djmatlab/matlab/functions/make_image_http_header.m

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)