diff --git a/matlab/CalcNF2FF.m b/matlab/CalcNF2FF.m index b4123d0..e5868ae 100644 --- a/matlab/CalcNF2FF.m +++ b/matlab/CalcNF2FF.m @@ -85,7 +85,15 @@ struct_2_xml(nf2ff.xml,nf2ff_xml,'nf2ff'); m_filename = mfilename('fullpath'); dir_name = fileparts( m_filename ); -openEMS_Path = [dir_name filesep '..' filesep]; + +if isunix + % could be /usr or ~/opt/openEMS etc. + % assume this file to be in '/share/openEMS/matlab/' + % assume openEMS binary to be in '/bin' + openEMS_Path = [dir_name filesep '../../../bin' filesep]; +else + openEMS_Path = [dir_name filesep '..' filesep]; +end if ((exist(nf2ff.hdf5,'file') && (mode==0)) || (mode==2)) disp('CalcNF2FF: Reading nf2ff data only...') @@ -104,7 +112,7 @@ cd(Sim_Path); try if isunix % remove LD_LIBRARY_PATH set by matlab - system(['export LD_LIBRARY_PATH=; ' openEMS_Path 'nf2ff/nf2ff ' filename '.xml']); + system(['export LD_LIBRARY_PATH=; ' openEMS_Path 'nf2ff ' filename '.xml']); else system([openEMS_Path 'nf2ff.exe ' filename '.xml']); end diff --git a/matlab/private/invoke_openEMS.m b/matlab/private/invoke_openEMS.m index 48a62c8..24bba3f 100644 --- a/matlab/private/invoke_openEMS.m +++ b/matlab/private/invoke_openEMS.m @@ -31,11 +31,15 @@ end filename = mfilename('fullpath'); dir = fileparts( filename ); -openEMS_Path = [dir filesep '../..' filesep]; if isunix + % could be /usr or ~/opt/openEMS etc. + % assume this file to be in '/share/openEMS/matlab/private/' + % assume openEMS binary to be in '/bin' + openEMS_Path = [dir filesep '../../../../bin' filesep]; openEMS_Path = [openEMS_Path 'openEMS.sh']; else + openEMS_Path = [dir filesep '../..' filesep]; openEMS_Path = [openEMS_Path 'openEMS']; end