In [1]:
%run ../common.ipynb
from __future__ import division
print(1/2, '<-- should be 0.5, not zero') # test division


Populating the interactive namespace from numpy and matplotlib
Matlab usage:

    %%matlab
    a = 1

or
    results = mlab.run_code('a=1;')

or

    res = mlab.run_func('path/to/function.m', {'arg1': 3, 'arg2': 5})

See https://github.com/arokem/python-matlab-bridge#usage for more details.

Starting MATLAB on ZMQ socket ipc:///tmp/pymatbridge
Send 'exit' command to kill the server
.MATLAB started and connected!
(0.5, '<-- should be 0.5, not zero')

In [2]:
images = imread('sample.tif')

In [3]:
for img in images:
    gimshow(img)



In [4]:
image = msmooth(images[1]) # HyD reflected visible
gimshow(image, title='HyD reflected visible')



In [5]:
histshow(image)



In [2]:
%%file f.m
function f()
    % imfinfo show images in file - here we want image nr two (of three)
    image = imread('sample.tif', 'Index', 2);
    image(100:110,100:110)
end


Overwriting f.m

In [3]:
res = mlab.run_func('f.m')


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-0bac4eddfe65> in <module>()
----> 1 res = mlab.run_func('f.m')

/Users/arve/Dokumenter/git/FY3490/.vs.env/lib/python2.7/site-packages/pymatbridge/pymatbridge.pyc in run_func(self, func_path, func_args, maxtime)
    197 
    198         req = json.dumps(req, cls=ComplexEncoder)
--> 199         self.socket.send(req)
    200         resp = self.socket.recv_string()
    201         resp = json.loads(resp, object_hook=as_complex)

AttributeError: 'NoneType' object has no attribute 'send'

In [ ]: