function [model_fin]=levelmod_2_expmod(fname,variab)


namemodN=regexp(fname,'\.');
if isempty(namemodN)
    namemodN=length(fname)+1;
    fname=strcat(fname,'.mod');
end
    
namemod=fname(1:namemodN-1);
model=(textread(fname,'%c','bufsize',1000000,'commentstyle','c++'));
model2=(strread(model','%s','delimiter',';'));
model=char(model2);
%%%%%%%%%%
if 0

if ~exist(['matrices_',namemod,'.mat'],'file');
    disp(['The file <', ['matrices_',namemod] ,'> could not be found in the current directory']);
    return
end

eval(['load matrices_',namemod]);
model=matrices.model;
variab=matrices.varyt;
allvar=str2cell(variab);
nsh=size(matrices.shocky,1);
for kk=1:size(variab,1);
    allvar{end+1,1}=[deblank(variab(kk,:)),'_plus1'];
    allvar{end+1,1}=[deblank(variab(kk,:)),'_minus1'];
end

end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
modstrt=find_incell((model2),['varexo(?!\_)']);
varexo=[model(modstrt,:) ',']; % varexo=[varexo ',']
varexo=regexprep(varexo,'varexo','');
name_inno=varexo;
gg=textscan(varexo,'%s','delimiter',',');
nsh=size(gg{1},1);
modstrt= find_incell(model2,'\<model');
modend=find_incell(model2(modstrt+1:end,:),'\<end')+modstrt;
% modend=modjunk(min(find(modjunk>modstrt)));
model2=model2(modstrt+1:modend-1,:);
allvar=str2cell(variab);
for kk=1:size(variab,1);
    allvar{end+1,1}=[deblank(variab(kk,:)),'_plus1'];
    allvar{end+1,1}=[deblank(variab(kk,:)),'_minus1'];
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
%   keyboard  
    [model]=lev2exp(model2,cell2str(allvar),1,nsh);
    
    model=mine2dyn(model);
%  keyboard;   
    
       model_fin=[];
       zz=1;
   for jj=1:size(model,1);
      model_fin{zz,1}=['// Equation ',num2str(zz),';'];  
       zz=zz+1;
       model_fin{zz,1}=[deblank(model{jj}),';'];
        zz=zz+1;
   end
    return
