diff --git a/pymatbridge/matlab/util/pymat_get_variable.m b/pymatbridge/matlab/util/pymat_get_variable.m index 8e6a29e..9de9cf1 100644 --- a/pymatbridge/matlab/util/pymat_get_variable.m +++ b/pymatbridge/matlab/util/pymat_get_variable.m @@ -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 diff --git a/pymatbridge/pymatbridge.py b/pymatbridge/pymatbridge.py index 4aad82e..1888d87 100644 --- a/pymatbridge/pymatbridge.py +++ b/pymatbridge/pymatbridge.py @@ -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 diff --git a/pymatbridge/version.py b/pymatbridge/version.py index 90ba94d..814367b 100644 --- a/pymatbridge/version.py +++ b/pymatbridge/version.py @@ -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'] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..02ec117 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pyzmq diff --git a/setup.py b/setup.py index 4c55b21..30fc215 100755 --- a/setup.py +++ b/setup.py @@ -49,6 +49,7 @@ def copy_bin(bin_path): packages=PACKAGES, package_data=PACKAGE_DATA, requires=REQUIRES, + extras_require=EXTRAS_REQUIRE, scripts=BIN )