In [1]:
%run ../../matlab.ipynb
mlab.startup_options


Starting MATLAB on ZMQ socket ipc:///tmp/pymatbridge
Send 'exit' command to kill the server
/Applications/MATLAB_R2014b.app/bin/matlab  -nodesktop -nodisplay -r "warning('off','all');addpath(genpath('/Users/arve/.virtualenvs/brew/lib/python2.7/site-packages/pymatbridge/matlab'));warning('on', 'all');matlabserver('ipc:///tmp/pymatbridge');exit"
............................................................MATLAB session timed out after 60 seconds
MATLAB failed to start
Starting MATLAB on ZMQ socket ipc:///tmp/pymatbridge
Send 'exit' command to kill the server
matlab  -nodesktop -nodisplay -r "warning('off','all');addpath(genpath('/Users/arve/.virtualenvs/brew/lib/python2.7/site-packages/pymatbridge/matlab'));warning('on', 'all');matlabserver('ipc:///tmp/pymatbridge');exit"
.MATLAB started and connected!

In [3]:
%%matlab -i p
cd %p;


/Users/arve/Dokumenter/git/H14/FY3490/fourier_filtering-gw-chap4.6


In [8]:
#%qtconsole
%load benchmark_matlab.m

In [ ]:
%%matlab
image = imread('../mp.tif');
matlab_F = fft2(image);
F = log(abs(fftshift(matlab_F)));
imshow(F, [min(F(:)), max(F(:))]);

In [5]:
%%matlab
image = imread('../mp.tif');
matlab_F = fft2(image);
F = log(abs(fftshift(matlab_F)));

In [6]:
%%matlab
F(10:20,10:20)


ans =

  Columns 1 through 7

    7.8213    7.2008    7.0105    7.7019    7.9257    7.0075    8.1100
    6.7147    7.1919    7.1974    7.8395    8.1601    7.3150    7.6837
    6.8462    7.4945    7.2204    7.6096    8.0403    7.3458    7.4644
    7.6136    7.9234    7.4581    7.9107    7.7509    7.3289    7.5799
    7.7267    7.0635    7.6919    7.9662    7.7348    7.7509    7.7226
    7.0905    7.8059    8.1610    8.1667    7.9939    7.5900    7.9596
    7.4339    6.9458    7.8321    7.9297    7.6984    7.7087    8.1173
    7.3710    6.5116    7.7949    8.0517    6.4182    6.7917    7.9713
    7.0366    7.3969    7.1873    6.9600    7.2080    6.5192    7.6049
    7.3853    6.4234    7.4098    7.6610    7.5769    7.5040    6.3912
    7.8029    6.6401    5.4540    6.4747    7.5740    7.8062    7.0406

  Columns 8 through 11

    7.2717    7.5656    7.7236    7.0106
    7.3482    7.6637    6.4421    6.9455
    7.3581    8.1147    7.1044    6.9721
    7.6135    7.8759    7.1012    7.7286
    8.0262    7.8386    7.3476    7.1455
    8.2493    7.6708    7.3855    7.2287
    7.6167    7.6118    7.8416    7.4585
    7.9727    7.9401    8.0085    7.6307
    7.3509    8.0225    7.6531    7.5994
    7.1739    8.0799    8.2132    7.2009
    7.4870    8.2318    7.8926    7.7194


In [7]:
%%matlab
imshow(F)


---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-7-7ab8a364cc67> in <module>()
----> 1 get_ipython().run_cell_magic(u'matlab', u'', u'imshow(F)')

/Users/arve/.virtualenvs/brew/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_cell_magic(self, magic_name, line, cell)
   2160             magic_arg_s = self.var_expand(line, stack_depth)
   2161             with self.builtin_trap:
-> 2162                 result = fn(magic_arg_s, cell)
   2163             return result
   2164 

/Users/arve/.virtualenvs/brew/lib/python2.7/site-packages/pymatbridge/matlab_magic.pyc in matlab(self, line, cell, local_ns)

/Users/arve/.virtualenvs/brew/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
    191     # but it's overkill for just that one bit of state.
    192     def magic_deco(arg):
--> 193         call = lambda f, *a, **k: f(*a, **k)
    194 
    195         if callable(arg):

/Users/arve/.virtualenvs/brew/lib/python2.7/site-packages/pymatbridge/matlab_magic.pyc in matlab(self, line, cell, local_ns)
    215             e_s += "\n-----------------------"
    216             e_s += "\nAre you sure Matlab is started?"
--> 217             raise RuntimeError(e_s)
    218 
    219 

RuntimeError: There was an error running the code:
 imshow(F)
-----------------------
Are you sure Matlab is started?

In [4]:
%%matlab
t = linspace(0,6*pi,100);
plot(sin(t))
grid on
hold on
plot(cos(t), 'r')