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
2 changes: 1 addition & 1 deletion pymatbridge/matlab/util/pymat_get_variable.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
% if the var doesn't exist in the workspace, inform adequately
expr = strcat('exist(''', varname, ''',''var'')');
var_exists = evalin('base', expr);
if ~var_exists;
if ~var_exists
response.exists = false;
response.var = '';
else
Expand Down
33 changes: 29 additions & 4 deletions pymatbridge/pymatbridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,36 @@
pymatbridge
===========

This is a module for communicating and running
This is a module for communicating and running Matlab from within python

Example
-------

>>> import pymatbridge
>>> m = pymatbridge.Matlab()
>>> m.start()
Starting MATLAB on ZMQ socket ipc:///tmp/pymatbridge
Send 'exit' command to kill the server
.MATLAB started and connected!
True
>>>
< M A T L A B (R) >
Copyright 1984-2014 The MathWorks, Inc.
R2014b (8.4.0.150421) 64-bit (maci64)
September 15, 2014


To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.

Socket created at: ipc:///tmp/pymatbridge

>>>
>>> m.run_code('a=1;')
{'content': {'stdout': '', 'datadir': '/private/tmp/MatlabData/', 'code': 'a=1;', 'figures': []}, 'success': 'true'}
>>> m.get_variable('a')
1

Part of Python-MATLAB-bridge, Max Jaderberg 2012

This is a modified version using ZMQ, Haoxing Zhang Jan.2014
"""

import os
Expand Down
4 changes: 3 additions & 1 deletion pymatbridge/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,7 @@
"matlab/util/json_v0.2.2/json/java/*",
"tests/*.py", "examples/*.ipynb"]}

REQUIRES = []
REQUIRES = ['pyzmq']
EXTRAS_REQUIRE = ['numpy', 'scipy', 'ipython']

BIN=['scripts/publish-notebook']
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyzmq
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def copy_bin(bin_path):
packages=PACKAGES,
package_data=PACKAGE_DATA,
requires=REQUIRES,
extras_require=EXTRAS_REQUIRE,
scripts=BIN
)

Expand Down