Code covered by the BSD License  

Highlights from
f2matlab

f2matlab

by

 

16 Jun 2004 (Updated )

Converts basic fortran90 source code to MATLAB source code.

out=findNext(loc,str,funstr,direction)
function out=findNext(loc,str,funstr,direction)
% returns -1 if can't find what you ask

if nargin<4, direction=1; end

if direction==1
 found=strfind(funstr,str);
 if isempty(found)
  out=-1;
  return
 end
 found=found(found>loc);
 if isempty(found)
  out=-1;
  return
 end
 
 out=found(1);
 
else
 found=strfind(funstr,str);
 if isempty(found)
  out=-1;
  return
 end
 found=found(found<loc);
 if isempty(found)
  out=-1;
  return
 end
 
 out=found(end);
 
 
end

Contact us