function create_setting
global zeng2 
%---------------------------------------------------------------
for i=1:length(zeng2.dummyvar)
    zeng.var{i}.setting=[];
    if zeng2.dummyvar{i}.Lmode==1 %Fix
        if isempty(zeng2.dummyvar{i}.lnodal)
            zeng2.var{i}.setting.lseg= zeng2.dummyvar{i}.L/zeng2.dummyvar{i}.nseg;
        else
            zeng2.var{i}.setting.lseg= zeng2.dummyvar{i}.L/zeng2.dummyvar{i}.nseg - zeng2.dummyvar{i}.lnodal;
        end
    elseif zeng2.dummyvar{i}.Lmode==2 %L=nseg.D.(Linternodal/D)
        if isempty(zeng2.dummyvar{i}.lnodal)
            zeng2.var{i}.setting.lseg= zeng2.dummyvar{i}.Linter_D*zeng2.dummyvar{i}.dia;
        else
            zeng2.var{i}.setting.lseg= zeng2.dummyvar{i}.Linter_D*zeng2.dummyvar{i}.dia - zeng2.dummyvar{i}.lnodal;
        end
    else
        zexst('err',['Something wrong in "Setting"'])
        zeng2.notreadytorun=1;
        return
    end
    %axialarea-------------------------------------------------------------
    if isempty(zeng2.dummyvar{i}.da_D) | zeng2.dummyvar{i}.da_D<=0 | zeng2.dummyvar{i}.da_D>1
        zexst('err','da_D needs to be in between [ 0 1]')
        zeng2.notreadytorun=1;
        return
    end
    zeng2.var{i}.setting.axialarea=pi/4*(zeng2.dummyvar{i}.da_D*zeng2.dummyvar{i}.dia)^2*(1e-8);               %cm2
    %nodalarea--------------------------------------------------------------------------
    if isempty(zeng2.dummyvar{i}.dn_D) | zeng2.dummyvar{i}.dn_D<=0 | zeng2.dummyvar{i}.dn_D>1
         zexst('err','dn_D needs to be in between [ 0 1]')
        zeng2.notreadytorun=1;
        return
    end
    dnodal=zeng2.dummyvar{i}.dn_D*zeng2.dummyvar{i}.dia;
    if isempty(zeng2.dummyvar{i}.lnodal)
       lnodal=zeng2.var{i}.setting.lseg;
    else
       lnodal=zeng2.dummyvar{i}.lnodal;
    end
    zeng2.var{i}.setting.nodalarea  =pi*dnodal*lnodal*(1e-8);                               %cm2     =used in matrix, zCal_I
    zeng2.var{i}.setting.cm_area    =zeng2.dummyvar{i}.cm*zeng2.var{i}.setting.nodalarea;   %cm x cm2=used in Zrun  
    %--------------------------------------------------------------------------
    zeng2.var{i}.setting.ga = zeng2.var{i}.setting.axialarea/(zeng2.dummyvar{i}.ra*zeng2.var{i}.setting.lseg * 1e-4);   %1/ohm
    %--------------------------------------------------------------------------
    if zeng2.options.vestim==1  %calculated
        %xyz is automatically adjusted only if xyzi and xyzc do exist.
        if ~isempty(zeng2.dummyvar{i}.xyzi) & ~isempty(zeng2.dummyvar{i}.xyzc)
            if size(zeng2.dummyvar{i}.xyzi,1)==1 & size(zeng2.dummyvar{i}.xyzi,2)==3 & size(zeng2.dummyvar{i}.xyzc,1)==1 & size(zeng2.dummyvar{i}.xyzc,2)==3
                zeng2.dummyvar{i}.xyz=setxyz(zeng2.dummyvar{i}.xyzi,zeng2.dummyvar{i}.xyzc,zeng2.dummyvar{i}.L,zeng2.dummyvar{i}.nseg);
            else
                zexst('err',[zeng2.dummyvar{i}.name 'is bad.'   char(13) 'xyzi and xyzc have to be either EMPTY or in this [x y z] format. '])
                zeng2.notreadytorun=1;
            end
        end
    elseif zeng2.options.vestim==2 %imported
        
    else
        zexst('err',['Something wrong with Ve in "Setting"'])
        zeng2.notreadytorun=1;
        return
    end
     %--------------------------------------------------------------------------
 end