function applyvis(handles,datadim,genchk,radio1,radio2,cmap,plottype,nbcol,bright,xlimmin,xlimmax,ylimmin,ylimmax,zlimmin,zlimmax,gridx,gridy,gridz,boxplot)
global modes coeffs clabelsmatrix isocoeffs indiso;
colorbar('off');
if datadim==1
    if (genchk==1 && radio1==1)
        axes(handles.mainframe1);
        contents = get(handles.popupmenu8,'String');
        popupmenu8value = contents{get(handles.popupmenu8,'Value')};
        probltype = get(handles.edit4,'String');
        [~, remain] = strtok(popupmenu8value);
        eval([plottype '(modes{str2num(remain)});']);
        xlim([str2num(xlimmin) str2num(xlimmax)]);
        ylim([str2num(ylimmin) str2num(ylimmax)]);
        if gridx==1
            set(handles.mainframe1,'XGrid','on');
        else
            set(handles.mainframe1,'XGrid','off');
        end
        if gridy==1
            set(handles.mainframe1,'YGrid','on');
        else
            set(handles.mainframe1,'YGrid','off');
        end
        if gridz==1
            set(handles.mainframe1,'ZGrid','on');
        else
            set(handles.mainframe1,'ZGrid','on');
        end
        if boxplot==1
            box on;
        else
            box off;
        end
    elseif (genchk==1 && radio2==1)
        axes(handles.mainframe2);
        contents = get(handles.popupmenu6,'String');
        popupmenu6value = contents{get(handles.popupmenu6,'Value')};
        if strfind(popupmenu6value,'Isotropic')
            if (indiso(1)==0 && indiso(2)==0 && indiso(3)==1)
                isonum=3;
            elseif (indiso(1)==0 && indiso(2)==1 && indiso(3)==0)
                isonum=2;
            elseif (indiso(1)==1 && indiso(2)==0 && indiso(3)==0)
                isonum=1;
            elseif (indiso(1)==0 && indiso(2)==1 && indiso(3)==1)
                if strfind(popupmenu6value,'lev. 2')
                    isonum=1;
                elseif strfind(popupmenu6value,'lev. 3')
                    isonum=2;
                end
            elseif (indiso(1)==1 && indiso(2)==0 && indiso(3)==1)
                if strfind(popupmenu6value,'lev. 1')
                    isonum=1;
                elseif strfind(popupmenu6value,'lev. 3')
                    isonum=2;
                end
            elseif (indiso(1)==1 && indiso(2)==1 && indiso(3)==0)
                if strfind(popupmenu6value,'lev. 1')
                    isonum=1;
                elseif strfind(popupmenu6value,'lev. 2')
                    isonum=2;
                end
            elseif (indiso(1)==1 && indiso(2)==1 && indiso(3)==1)
                if strfind(popupmenu6value,'lev. 1')
                    isonum=1;
                elseif strfind(popupmenu6value,'lev. 2')
                    isonum=2;
                elseif strfind(popupmenu6value,'lev. 3')
                    isonum=3;
                end
            end
        else
            [indx,indy]=find(ismember(clabelsmatrix,popupmenu6value));
        end
        probltype = get(handles.edit4,'String');
        if strfind(popupmenu6value,'Isotropic')
            eval([plottype '(isocoeffs{isonum});']);
        else
            eval([plottype '(coeffs{indx,indy});']);
        end
        xlim([str2num(xlimmin) str2num(xlimmax)]);
        ylim([str2num(ylimmin) str2num(ylimmax)]);
        if gridx==1
            set(handles.mainframe2,'XGrid','on');
        else
            set(handles.mainframe2,'XGrid','off');
        end
        if gridy==1
            set(handles.mainframe2,'YGrid','on');
        else
            set(handles.mainframe2,'YGrid','off');
        end
        if gridz==1
            set(handles.mainframe2,'ZGrid','on');
        else
            set(handles.mainframe2,'ZGrid','on');
        end
        if boxplot==1
            box on;
        else
            box off;
        end
    end
elseif datadim==2
    if (genchk==1 && radio1==1)
        axes(handles.mainframe1);
        set(handles.edit14,'Enable','on');
        set(handles.edit15,'Enable','on');
        set(handles.slider1,'Enable','on');
        set(handles.slider2,'Enable','on');
        set(handles.checkbox19,'Enable','on');
        contents = get(handles.popupmenu8,'String');
        popupmenu8value = contents{get(handles.popupmenu8,'Value')};
        probltype = get(handles.edit4,'String');
        [~, remain] = strtok(popupmenu8value);
        if strcmp(probltype,'Circular plate: stiff inclusion (exp)')
            R=0.5;
            csiz=size(modes{str2num(remain)});
            r=R/csiz(2):R/csiz(2):R;
            phi=0:2*pi/(csiz(1)-1):2*pi;
            [th,rq] = meshgrid(phi,r);
            [X_1,Y_1,Z_1] = pol2cart(th,rq,modes{str2num(remain)}');
            h = polar([0 2*pi], [0 R]);
            delete(h)
            hold on;
            eval(['C=' plottype '(X_1,Y_1,Z_1);']);
            hold off;
            eval(['colormap(' cmap '(' nbcol '));']);
            shading interp;
            brighten(str2num(bright));
            set(findall(gca,'Type','patch'),'FaceColor','none');
            c=colorbar('location','southoutside');
            cpos = get(c,'Position');
            cpos=[0.052657004830918 0.083762149799886 0.435748792270531 0.5*cpos(4)];
            set(c,'Position',cpos);
        elseif (strcmp(probltype,'Circular plate: surface damage 1 (num)') || strcmp(probltype,'Circular plate: surface damage 2 (num)') || strcmp(probltype,'Circular plate: delamination (num)') || strcmp(probltype,'Circular plate: internal void (num)'))
            R=0.25;
            csiz=size(modes{str2num(remain)});
            r=R/csiz(2):R/csiz(2):R;
            phi=0:2*pi/(csiz(1)-1):2*pi;
            [th,rq] = meshgrid(phi,r);
            [X_1,Y_1,Z_1] = pol2cart(th,rq,modes{str2num(remain)}');
            h = polar([0 2*pi], [0 R]);
            delete(h)
            hold on;
            eval(['C=' plottype '(X_1,Y_1,Z_1);']);
            hold off;
            eval(['colormap(' cmap '(' nbcol '));']);
            shading interp;
            brighten(str2num(bright));
            set(findall(gca,'Type','patch'),'FaceColor','none');
            c=colorbar('location','southoutside');
            cpos = get(c,'Position');
            cpos=[0.052657004830918 0.083762149799886 0.435748792270531 0.5*cpos(4)];
            set(c,'Position',cpos);
        else
            eval([plottype '(modes{str2num(remain)});']);
            eval(['colormap(' cmap '(' nbcol '));']);
            brighten(str2num(bright));
            xlim([str2num(xlimmin) str2num(xlimmax)]);
            ylim([str2num(ylimmin) str2num(ylimmax)]);
            zlim([str2num(zlimmin) str2num(zlimmax)]);
            if gridx==1
                set(handles.mainframe1,'XGrid','on');
            else
                set(handles.mainframe1,'XGrid','off');
            end
            if gridy==1
                set(handles.mainframe1,'YGrid','on');
            else
                set(handles.mainframe1,'YGrid','off');
            end
            if gridz==1
                set(handles.mainframe1,'ZGrid','on');
            else
                set(handles.mainframe1,'ZGrid','on');
            end
            if boxplot==1
                box on;
            else
                box off;
            end
            c=colorbar('location','southoutside');
            cpos = get(c,'Position');
            cpos=[0.052657004830918 0.083762149799886 0.435748792270531 0.5*cpos(4)];
            set(c,'Position',cpos);
            axis xy;
        end
    elseif (genchk==1 && radio2==1)
        axes(handles.mainframe2);
        set(handles.edit14,'Enable','on');
        set(handles.edit15,'Enable','on');
        set(handles.slider1,'Enable','on');
        set(handles.slider2,'Enable','on');
        set(handles.checkbox19,'Enable','on');
        contents = get(handles.popupmenu6,'String');
        popupmenu6value = contents{get(handles.popupmenu6,'Value')};
        probltype = get(handles.edit4,'String');
        if strfind(popupmenu6value,'Isotropic')
            if (indiso(1)==0 && indiso(2)==0 && indiso(3)==1)
                isonum=3;
            elseif (indiso(1)==0 && indiso(2)==1 && indiso(3)==0)
                isonum=2;
            elseif (indiso(1)==1 && indiso(2)==0 && indiso(3)==0)
                isonum=1;
            elseif (indiso(1)==0 && indiso(2)==1 && indiso(3)==1)
                if strfind(popupmenu6value,'lev. 2')
                    isonum=1;
                elseif strfind(popupmenu6value,'lev. 3')
                    isonum=2;
                end
            elseif (indiso(1)==1 && indiso(2)==0 && indiso(3)==1)
                if strfind(popupmenu6value,'lev. 1')
                    isonum=1;
                elseif strfind(popupmenu6value,'lev. 3')
                    isonum=2;
                end
            elseif (indiso(1)==1 && indiso(2)==1 && indiso(3)==0)
                if strfind(popupmenu6value,'lev. 1')
                    isonum=1;
                elseif strfind(popupmenu6value,'lev. 2')
                    isonum=2;
                end
            elseif (indiso(1)==1 && indiso(2)==1 && indiso(3)==1)
                if strfind(popupmenu6value,'lev. 1')
                    isonum=1;
                elseif strfind(popupmenu6value,'lev. 2')
                    isonum=2;
                elseif strfind(popupmenu6value,'lev. 3')
                    isonum=3;
                end
            end
        else
            [indx,indy]=find(ismember(clabelsmatrix,popupmenu6value));
        end
        if strcmp(probltype,'Circular plate: stiff inclusion (exp)')
            R=0.5;
            csiz=size(coeffs{indx,indy});
            r=R/csiz(2):R/csiz(2):R;
            phi=0:2*pi/(csiz(1)-1):2*pi;
            [th,rq] = meshgrid(phi,r);
            [X_1,Y_1,Z_1] = pol2cart(th,rq,coeffs{indx,indy}');
            h = polar([0 2*pi], [0 R]);
            delete(h)
            hold on;
            eval(['C=' plottype '(X_1,Y_1,Z_1);']);
            hold off;
            eval(['colormap(' cmap '(' nbcol '));']);
            shading interp;
            brighten(str2num(bright));
            set(findall(gca,'Type','patch'),'FaceColor','none');
            c=colorbar('location','southoutside');
            cpos = get(c,'Position');
            cpos=[0.546376811594203 0.083762149799886 0.435748792270531 0.5*cpos(4)];
            set(c,'Position',cpos);
        elseif (strcmp(probltype,'Circular plate: surface damage 1 (num)') || strcmp(probltype,'Circular plate: surface damage 2 (num)') || strcmp(probltype,'Circular plate: delamination (num)') || strcmp(probltype,'Circular plate: internal void (num)'))
            R=0.25;
            csiz=size(coeffs{indx,indy});
            r=R/csiz(2):R/csiz(2):R;
            phi=0:2*pi/(csiz(1)-1):2*pi;
            [th,rq] = meshgrid(phi,r);
            [X_1,Y_1,Z_1] = pol2cart(th,rq,coeffs{indx,indy}');
            h = polar([0 2*pi], [0 R]);
            delete(h)
            hold on;
            eval(['C=' plottype '(X_1,Y_1,Z_1);']);
            hold off;
            eval(['colormap(' cmap '(' nbcol '));']);
            shading interp;
            brighten(str2num(bright));
            set(findall(gca,'Type','patch'),'FaceColor','none');
            c=colorbar('location','southoutside');
            cpos = get(c,'Position');
            cpos=[0.546376811594203 0.083762149799886 0.435748792270531 0.5*cpos(4)];
            set(c,'Position',cpos);
        else
            if strfind(popupmenu6value,'Isotropic')
                eval([plottype '(isocoeffs{isonum});']);
            else
                eval([plottype '(coeffs{indx,indy});']);
            end
            eval(['colormap(' cmap '(' nbcol '));']);
            brighten(str2num(bright));
            xlim([str2num(xlimmin) str2num(xlimmax)]);
            ylim([str2num(ylimmin) str2num(ylimmax)]);
            zlim([str2num(zlimmin) str2num(zlimmax)]);
            if gridx==1
                set(handles.mainframe2,'XGrid','on');
            else
                set(handles.mainframe2,'XGrid','off');
            end
            if gridy==1
                set(handles.mainframe2,'YGrid','on');
            else
                set(handles.mainframe2,'YGrid','off');
            end
            if gridz==1
                set(handles.mainframe2,'ZGrid','on');
            else
                set(handles.mainframe2,'ZGrid','on');
            end
            if boxplot==1
                box on;
            else
                box off;
            end
            c=colorbar('location','southoutside');
            cpos = get(c,'Position');
            cpos=[0.546376811594203 0.083762149799886 0.435748792270531 0.5*cpos(4)];
            set(c,'Position',cpos);
            axis xy;
        end
    end
elseif datadim==3
    if (genchk==1 && radio1==1)
        axes(handles.mainframe1);
        set(handles.edit14,'Enable','on');
        set(handles.edit15,'Enable','on');
        set(handles.slider1,'Enable','on');
        set(handles.slider2,'Enable','on');
        set(handles.checkbox19,'Enable','on');
        cla;
        vol3d('CData',(modes{1}),'texture','3D');
        view(3);
        axis tight;
        eval(['colormap(' cmap '(' nbcol '));']);
        brighten(str2num(bright));
        xlim([str2num(xlimmin) str2num(xlimmax)]);
        ylim([str2num(ylimmin) str2num(ylimmax)]);
        zlim([str2num(zlimmin) str2num(zlimmax)]);
        if gridx==1
            set(handles.mainframe1,'XGrid','on');
        else
            set(handles.mainframe1,'XGrid','off');
        end
        if gridy==1
            set(handles.mainframe1,'YGrid','on');
        else
            set(handles.mainframe1,'YGrid','off');
        end
        if gridz==1
            set(handles.mainframe1,'ZGrid','on');
        else
            set(handles.mainframe1,'ZGrid','on');
        end
        if boxplot==1
            box on;
        else
            box off;
        end
        c=colorbar('location','southoutside');
        cpos = get(c,'Position');
        cpos=[0.052657004830918 0.083762149799886 0.435748792270531 0.5*cpos(4)];
        set(c,'Position',cpos);
    elseif (genchk==1 && radio2==1)
        axes(handles.mainframe2);
        set(handles.edit14,'Enable','on');
        set(handles.edit15,'Enable','on');
        set(handles.slider1,'Enable','on');
        set(handles.slider2,'Enable','on');
        set(handles.checkbox19,'Enable','on');
        contents = get(handles.popupmenu6,'String');
        popupmenu6value = contents{get(handles.popupmenu6,'Value')};
        probltype = get(handles.edit4,'String');
        if strfind(popupmenu6value,'Isotropic')
            if (indiso(1)==0 && indiso(2)==0 && indiso(3)==1)
                isonum=3;
            elseif (indiso(1)==0 && indiso(2)==1 && indiso(3)==0)
                isonum=2;
            elseif (indiso(1)==1 && indiso(2)==0 && indiso(3)==0)
                isonum=1;
            elseif (indiso(1)==0 && indiso(2)==1 && indiso(3)==1)
                if strfind(popupmenu6value,'lev. 2')
                    isonum=1;
                elseif strfind(popupmenu6value,'lev. 3')
                    isonum=2;
                end
            elseif (indiso(1)==1 && indiso(2)==0 && indiso(3)==1)
                if strfind(popupmenu6value,'lev. 1')
                    isonum=1;
                elseif strfind(popupmenu6value,'lev. 3')
                    isonum=2;
                end
            elseif (indiso(1)==1 && indiso(2)==1 && indiso(3)==0)
                if strfind(popupmenu6value,'lev. 1')
                    isonum=1;
                elseif strfind(popupmenu6value,'lev. 2')
                    isonum=2;
                end
            elseif (indiso(1)==1 && indiso(2)==1 && indiso(3)==1)
                if strfind(popupmenu6value,'lev. 1')
                    isonum=1;
                elseif strfind(popupmenu6value,'lev. 2')
                    isonum=2;
                elseif strfind(popupmenu6value,'lev. 3')
                    isonum=3;
                end
            end
        else
            [indx,indy]=find(ismember(clabelsmatrix,popupmenu6value));
        end
        cla;
        if strfind(popupmenu6value,'Isotropic')
            vol3d('CData',(isocoeffs{isonum}),'texture','3D');
        else
            vol3d('CData',(coeffs{indx,indy}),'texture','3D');
        end
        view(3);
        axis tight;
        eval(['colormap(' cmap '(' nbcol '));']);
        brighten(str2num(bright));
        xlim([str2num(xlimmin) str2num(xlimmax)]);
        ylim([str2num(ylimmin) str2num(ylimmax)]);
        zlim([str2num(zlimmin) str2num(zlimmax)]);
        if gridx==1
            set(handles.mainframe2,'XGrid','on');
        else
            set(handles.mainframe2,'XGrid','off');
        end
        if gridy==1
            set(handles.mainframe2,'YGrid','on');
        else
            set(handles.mainframe2,'YGrid','off');
        end
        if gridz==1
            set(handles.mainframe2,'ZGrid','on');
        else
            set(handles.mainframe2,'ZGrid','on');
        end
        if boxplot==1
            box on;
        else
            box off;
        end
        c=colorbar('location','southoutside');
        cpos = get(c,'Position');
        cpos=[0.546376811594203 0.083762149799886 0.435748792270531 0.5*cpos(4)];
        set(c,'Position',cpos);
    end
end