Code covered by the BSD License  

Highlights from
matlab2fmex

image thumbnail
from matlab2fmex by Ben Barrowes
matlab2fmex.m is a small translator which aims to convert numerical M-files to Fortran90 mex.

str=convertconditional(str)
function str=convertconditional(str)
goon=1;
temp=findstr(str,'~=');
while ~isempty(temp)
 str=[str(1:temp(1)-1),'/=',str(temp(1)+2:length(str))];
 temp=findstr(str,'~=');
end

temp=findstr(str,'~');
while ~isempty(temp)
 str=[str(1:temp(1)-1),'.not.',str(temp(1)+1:length(str))];
 temp=findstr(str,'~');
end

temp=findstr(str,'|');
while ~isempty(temp)
 str=[str(1:temp(1)-1),'.or.',str(temp(1)+1:length(str))];
 temp=findstr(str,'|');
end

temp=findstr(str,'&');
while ~isempty(temp)
 str=[str(1:temp(1)-1),'.and.',str(temp(1)+1:length(str))];
 temp=findstr(str,'&');
end

Contact us at files@mathworks.com