Run Unix executable binary on MATLAB
Contents
As a MATLAB guy and *nix guy, you may want to fulfill everything on MATLAB, or on command line. I will choose the former one.
Call SYSTEM command in MATLAB
MATLAB has its own bssh PATH
, which is different from the *nix PATH. But a workaround consists in modifying the script (/Applications/MATLAB_R*****.app/bin/matlab
) that launches MATLAB.
$ cd /Applications/MATLAB_R*****.app/bin/
$ vi matlab
# add the following line after #!/bin/sh
$ export PATH:$PATH
Then, add this matlab
into your ~/.bashrc
and call matlab &
from command line.
- Note: If you run the original MATLAB shortcut from the launchpad, it won’t find the system PATH.
DYLD error
MATLAB’s DYLD_LIBRARY_PATH
is different from bash’s. You might get some error like :
>> unix('convert filename -trim filename');
dyld: Library not loaded: /opt/local/lib/libfreetype.6.dylib
Referenced from: /opt/local/bin/convert
Reason: Incompatible library version: convert requires version 19.0.0 or later, but libfreetype.6.dylib provides version 18.0.0
convert /U
In order to avoid conflicts, set it empty >> setenv('DYLD_LIBRARY_PATH','');
.
Author F. Cheng
LastMod 2018-04-18