MacPorts commands from MATLAB prompt
From WikiHistedOrg
You can add this code to startup.m
In particular this is useful to run imagemagick commands like convert or mogrify. Note you need to update DYLD_LIBRARY_PATH not LD_LIBRARY_PATH or the libtiff shipped with Matlab will cause a conflict ("Incompatible library version")
if ismac
% add to shell path so we can find MacPorts commands
if isempty(strfind(getenv('PATH'), 'opt'))
setenv('PATH', ['/opt/local/bin:/opt/local/sbin:' getenv('PATH')]);
end
if isempty(strfind(getenv('DYLD_LIBRARY_PATH'), 'opt'))
setenv('DYLD_LIBRARY_PATH', ...
['/opt/local/lib:' getenv('DYLD_LIBRARY_PATH')]);
end
end
keywords: matlab convert mogrify shell imagemagick library ld dyld LD_LIBRARY_PATH DYLD_LIBRARY_PATH
(one error follows)
>> !convert dyld: Library not loaded: /opt/local/lib/libtiff.3.dylib Referenced from: /opt/local/bin/convert Reason: Incompatible library version: convert requires version 12.0.0 or later, but libtiff.3.dylib provides version 11.0.0

