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=lastNonSpace(str,locs)
function out=lastNonSpace(str,locs)

%finds the last non space location before loc(s)

temp=find(~isspace(str));

out=zeros(size(locs));

for ii=1:length(locs)
 temp1=temp(temp<locs(ii));
 if ~isempty(temp1)
  out(ii)=temp1(end);
 else % => inf?
  out(ii)=0;
 end
end % for ii=1:locs
 

Contact us