function finflag=chkbesett(handles,coeffs)

chk1=get(handles.mainframe2,'Visible');
chk2=get(handles.popupmenu6,'String');
if (~isempty(coeffs) && (strcmp(chk1,'on') || iscell(chk2)))
    ExtLength=get(handles.edit6,'String');
    if (~all(ismember(ExtLength,'1234567890')) || isempty(ExtLength))
        msgbox('Input of extension length is incorrect!','Error #015');
        flagBadLength=0;
        finflag=0;
    else
        flagBadLength=1;
        coeffsize=size(coeffs);
        ControlFactor=size(coeffs{1});
        Smallest=[];
        for i=1:coeffsize(1)
            for j=1:coeffsize(2)
                CurrSizeCoeff=size(coeffs{i,j});
                if length(CurrSizeCoeff)==2
                    if (CurrSizeCoeff(1)~=ControlFactor(1) || CurrSizeCoeff(2)~=ControlFactor(2))
                        if (CurrSizeCoeff(1)<ControlFactor(1) || CurrSizeCoeff(2)<ControlFactor(2))
                            Smallest=CurrSizeCoeff;
                        end
                    elseif (CurrSizeCoeff(1)==ControlFactor(1) && CurrSizeCoeff(2)==ControlFactor(2))
                        Smallest=CurrSizeCoeff;
                    end
                elseif length(CurrSizeCoeff)==3
                    if (CurrSizeCoeff(1)~=ControlFactor(1) || CurrSizeCoeff(2)~=ControlFactor(2) || CurrSizeCoeff(3)~=ControlFactor(3))
                        if (CurrSizeCoeff(1)<ControlFactor(1) || CurrSizeCoeff(2)<ControlFactor(2) || CurrSizeCoeff(3)<ControlFactor(3))
                            Smallest=CurrSizeCoeff;
                        end
                    elseif (CurrSizeCoeff(1)==ControlFactor(1) && CurrSizeCoeff(2)==ControlFactor(2))
                        Smallest=CurrSizeCoeff;
                    end
                end
            end
        end
        if Smallest(1)==1
            Smallest=Smallest(2);
        elseif Smallest(2)==1
            Smallest=Smallest(1);
        end
        if length(Smallest)==1
            ChkExt=Smallest-2*str2num(ExtLength);
            if ChkExt<1
                msgbox({'Extension length is too big for considered case!','Please consider the smaller value.'},'Error #016');
                flagBadSize=0;
            else
                flagBadSize=1;
            end
        elseif length(Smallest)==2
            ChkExt1=Smallest(1)-2*str2num(ExtLength);
            ChkExt2=Smallest(2)-2*str2num(ExtLength);
            if (ChkExt1<1 || ChkExt2<1)
                msgbox({'Extension length is too big for considered case!','Please consider the smaller value.'},'Error #017');
                flagBadSize=0;
            else
                flagBadSize=1;
            end
        elseif length(Smallest)==3
            ChkExt1=Smallest(1)-2*str2num(ExtLength);
            ChkExt2=Smallest(2)-2*str2num(ExtLength);
            ChkExt3=Smallest(3)-2*str2num(ExtLength);
            if (ChkExt1<1 || ChkExt2<1 || ChkExt3<1)
                msgbox({'Extension length is too big for considered case!','Please consider the smaller value.'},'Error #018');
                flagBadSize=0;
            else
                flagBadSize=1;
            end
        end
        
        if (flagBadLength==1 && flagBadSize==1)
            finflag=1;
        else
            finflag=0;
        end
    end
else
    msgbox('The calculations should be performed first!','Error #019');
    finflag=0;
end