function plotmesh_two(mesh1,mesh2)

% plotmesh(mesh, plotflag,range)
%
% Allows fast and easy viewing of mesh
% 
% mesh is the input mesh (variable or filename)
% plotflag is optional, if it is 1, the source/detectors will show
% 
figure('Color',[1 1 1]);

%% load mesh
if ischar(mesh1)== 1
    mesh1 = load_mesh(mesh1);
end
if ischar(mesh2)== 1
    mesh2 = load_mesh(mesh2);
end

%%
range=[];
for i = 1:3
range=[range;min([min(mesh2.conc(:,i)),min(mesh2.conc(:,i))]),max([max(mesh2.conc(:,i)),max(mesh2.conc(:,i))])]
end
    % SPECTRAL
    if strcmp(mesh1.type,'spec') == 1
      [nc,junk]=size(mesh1.chromscattlist);

      if isfield(mesh1,'etamuaf')
        n = ceil((nc-2)/2)+2;
      else
        n = ceil((nc-2)/2)+1;
      end
      k = 1;
      for i = 1 : 3%nc-2
        
        subplot(3,2,k);
        plotim(mesh1,mesh1.conc(:,i),range(i,:));
        t = char(mesh1.chromscattlist(i,1));
        title(t,'FontSize',10);
        colorbar;
        
        subplot(3,2,k+1);
        plotim(mesh2,mesh2.conc(:,i),range(i,:));
        t = char(mesh2.chromscattlist(i,1));
        title(t,'FontSize',10);
        colorbar;
        
        k = k + 2;
      end
%       subplot(n,2,k+1);
%       plotim(mesh,mesh.sa,range);
%       title('Scatter Amplitude','FontSize',10);
%       colorbar;
%       subplot(n,2,k+2);
%       plotim(mesh,mesh.sp,range);
%       title('Scatter Power','FontSize',10);
%       colorbar;
%       if isfield(mesh,'etamuaf')
%         subplot(n,2,k+3);
%         plotim(mesh,mesh.etamuaf,range);
%         title('etamuaf','FontSize',10);
%         colorbar;
%       end
    else
        errordlg('Mesh type not supported','NIRFAST Error');
        error('Mesh type not supported');
    end
end
    
%% plot image function
function plotim(mesh,val,range)
if mesh.dimension == 3 && ...
        (strcmp(mesh.type,'stnd_bem') || strcmp(mesh.type,'spec_bem') || strcmp(mesh.type,'fluor_bem'))
    h = trisurf(mesh.elements,...
	    mesh.nodes(:,1),...
	    mesh.nodes(:,2),...
	    mesh.nodes(:,3),...
	    val,'FaceAlpha',0.5);
else
    h = trisurf(mesh.elements,...
	    mesh.nodes(:,1),...
	    mesh.nodes(:,2),...
	    mesh.nodes(:,3),...
	    val);
end
shading interp;
view(2);
axis equal; 
axis off;
colormap hot;
caxis (range)
end

%% set font function
function setfont(s)

title([],'fontsize',s);
xlabel([],'fontsize',s);
xlabel([],'fontsize',s);
set(gca,'fontsize',s);
        
end
