% OctaveFEMM (C)2004 David Meeker, dmeeker@ieee.org function openfemm(fn) global ifile ofile IsMatlab HandleToFEMM rootdir=tilde_expand('~/.wine/drive_c/Program Files/femm40/bin/'); IsMatlab=0; % define temporary file locations ifile=[rootdir,'ifile.txt']; ofile=[rootdir,'ofile.txt']; % test to see if there is already a femm process open try [fid,msg]=fopen(ifile,'wt'); catch [fid,msg]=fopen(ifile,'w'); end fprintf(fid,'flput(0)'); fclose(fid); sleep(0.25); try [fid,msg]=fopen(ofile,'rt'); catch [fid,msg]=fopen(ofile,'r'); end if (fid==-1) unlink(ifile); system(['wine "',rootdir,'femm.exe" -filelink 2> /dev/null'],1,'async'); else fclose(fid); unlink(ofile); disp('FEMM is already open'); end