Code covered by the BSD License  

Highlights from
f2matlab

f2matlab

by

 

16 Jun 2004 (Updated )

Converts basic fortran90 source code to MATLAB source code.

TESTING_csf.m
clear all;r=char(10);

functions={'mairya';'mairyb';'mairyzo';'maswfa';'maswfb';'mbernoa';'mbernob';'mbeta';'mcchg';'mcerror';'mcerzo';'mcgama';'mch12n';'mchgm';'mchgu';'mcik01';'mciklv';'mcikna';'mciknb';'mcikva';'mcikvb';'mcisia';'mcisib';'mcjk';'mcjy01';'mcjylv';'mcjyna';'mcjynb';'mcjyva';'mcjyvb';'mclpmn';'mclpn';'mclqmn';'mclqn';'mcomelp';'mcpbdn';'mcpsi';'mcsphik';'mcsphjy';'mcva1';'mcva2';'mcyzo';'me1xa';'me1xb';'me1z';'meix';'melit';'melit3';'menxa';'menxb';'merror';'meulera';'meulerb';'mfcoef';'mfcs';'mfcszo';'mffk';'mgamma';'mherzo';'mhygfx';'mhygfz';'mik01a';'mik01b';'mikna';'miknb';'mikv';'mincob';'mincog';'mitairy';'mitika';'mitikb';'mitjya';'mitjyb';'mitsh0';'mitsl0';'mitth0';'mittika';'mittikb';'mittjya';'mittjyb';'mjdzo';'mjelp';'mjy01a';'mjy01b';'mjyna';'mjynb';'mjyv';'mjyzo';'mklvna';'mklvnb';'mklvnzo';'mlagzo';'mlamn';'mlamv';'mlegzo';'mlgama';'mlpmn';'mlpmns';'mlpmv';'mlpn';'mlpni';'mlqmn';'mlqmns';'mlqna';'mlqnb';'mmtu0';'mmtu12';'mothpl';'mpbdv';'mpbvv';'mpbwa';'mpsi';'mrctj';'mrcty';'mrswfo';'mrswfp';'mscka';'msckb';'msdmn';'msegv';'msphi';'msphj';'msphk';'msphy';'mstvh0';'mstvh1';'mstvhv';'mstvl0';'mstvl1';'mstvlv'};
%functions={'maswfa'};

ttt1=cputime;
for i=1:length(functions)
 disp([char(10),char(10),'%%%%% ',functions{i},'.f90 --> ',...
       functions{i},'.m %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'])
 eval(['f2matlab(''',functions{i},'.f90'');']);
 eval(functions{i});
 disp(['%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'])
 fid=fopen([functions{i},'.m']); filestr=fscanf(fid,'%c'); fclose(fid);
 rets=findstr(r,filestr);
 %filestr(1:rets(40))
 %Add copyright.
 filestr=[filestr(1:rets(1)),...
          '%This program is a direct conversion of the corresponding Fortran program in',r,...
          '%S. Zhang & J. Jin "Computation of Special Functions" (Wiley, 1996).',r,...
          '%online: http://jin.ece.uiuc.edu/routines/routines.html',r,...
          '%',r,...
          '%Converted by f2matlab open source project:',r,...
          '%online: https://sourceforge.net/projects/f2matlab/',r,...
          '% written by Ben Barrowes (barrowes@alum.mit.edu)',r,...
          '%',...
          r,filestr(rets(1)+1:end)];
 fid=fopen([functions{i},'.m'],'w');  fprintf(fid,'%c',filestr);   fclose(fid);
end
disp(['converted and ran all ',num2str(length(functions)),' functions in ',num2str(cputime-ttt1),' seconds'])

Contact us