Changeset 238 for trunk/src/civ.m


Ignore:
Timestamp:
Apr 18, 2011, 10:42:29 PM (13 years ago)
Author:
sommeria
Message:

various bug corrections

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r236 r238  
    6666filebase=''; % root file name ('filebase'.civ)
    6767ext=[];
    68 testall=0;
     68set(handles.CivAll,'String',{'CivX';'CivAll';'CivUvmat'})
    6969%default input parameters:
    7070num_i1=1; % set of field i numbers
     
    106106end
    107107set(handles.RootName,'String',filebase);
    108 set(handles.ImaDoc,'UserData',testall);
    109108set(handles.ImaDoc,'String',ext)
    110109
     
    113112path_UVMAT=fileparts(path_uvmat); %path to UVMAT
    114113errormsg=[];%default error message
    115 % xmlfile=fullfile(path_UVMAT,'PARAM.xml');
    116 % if ~exist(xmlfile,'file')
    117114xmlfile='PARAM.xml';
    118 % end
    119115if exist(xmlfile,'file')
    120116    try
     
    269265    oldfile=filebase;
    270266end
    271 % testall=get(handles.ImaDoc,'UserData');
    272267ind_opening=1;%default
    273268browse.incr_pair=[0 0]; %default
    274 % if testall
    275 %     menu={'*.*', 'All Files (*.*)'; '*.xml; *.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ...
    276 %         '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc','.nc files'};
    277 % else % menu selecting only .civ or .avi files
    278  menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)';
     269menu={'*.xml;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.nc;', ' (*.xml,*.civ,*.png,*.jpg ,.tif, *.avi,*.nc)';
    279270       '*.xml',  '.xml files '; ...
    280271        '*.civ',  '.civ files '; ...
     
    285276        '*.nc','.netcdf files'; ...
    286277        '*.*',  'All Files (*.*)'};
    287    % menu={'*.xml;*.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ...
    288      %   '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc', '.nc files';...
    289     %    '*.*', 'All Files (*.*)'};
    290 % end
    291278[FileName, PathName, filtindex] = uigetfile( menu, 'Pick a file',oldfile);
    292279fileinput=[PathName FileName];%complete file name
     
    442429end
    443430set(handles.browse_root,'UserData',browse);% store information from browser
    444 % testall=isequal(menu(filtindex,1),{'*.*'});
    445 % set(handles.ImaDoc,'UserData',testall);
    446431
    447432RootName_Callback(hObject, eventdata, handles);
     
    15831568    end
    15841569end
    1585 civAll=isequal(get(handles.CivAll,'Value'),2); % Boolean for new civ programs
    1586 if civAll && isfield(sparam,'CivBin')
     1570
     1571%% choose the civ program
     1572ProgList=get(handles.CivAll,'String');
     1573index=get(handles.CivAll,'Value');
     1574CivX=isequal(ProgList{index},'CivX');
     1575CivAll=isequal(ProgList{index},'CivAll');
     1576CivUvmat=isequal(ProgList{index},'CivUvmat');
     1577%CivAll=isequal(get(handles.CivAll,'Value'),2); % Boolean for new civ programs
     1578if CivAll && isfield(sparam,'CivBin')
    15871579    CivBin=sparam.CivBin;
    15881580    if ~exist(CivBin,'file') || ~isempty(which(CivBin))% if path defined as relative to uvmat
     
    17391731            cmd=[cmd 'umask 002 \n'];%allow writting access to created files for user group
    17401732        end
    1741         if civAll
    1742             civAllxml=xmltree;% xml contents,  all parameters
    1743             civAllCmd='';
    1744             civAllxml=set(civAllxml,1,'name','CivDoc');
     1733        if CivAll
     1734            CivAllxml=xmltree;% xml contents,  all parameters
     1735            CivAllCmd='';
     1736            CivAllxml=set(CivAllxml,1,'name','CivDoc');
    17451737        end
    17461738        [Rootbat,Filebat]=fileparts(filecell.nc.civ1{ifile,j});%output netcdf file (without extention)
     
    18081800            %
    18091801            i_cmd=i_cmd+1;
    1810             if isequal(civAll,0)
     1802            if isequal(CivAll,0)
    18111803                civ1_exe=CIV1_CMD(fullfile(Rootbat,Filebat),'',par_civ1,handles,sparam);%create the parameter file .civ1.cmx and set the execution string civ1_exe
    18121804%                 if(isunix)
     
    18181810                cmd=[cmd civ1_exe '\n'];
    18191811            else
    1820                 civAllCmd=[civAllCmd ' civ1 '];
     1812                CivAllCmd=[CivAllCmd ' civ1 '];
    18211813                str=CIV1_CMD_Unified(fullfile(Rootbat,Filebat),'',par_civ1);
    18221814                fieldnames=fields(str);
    1823                 [civAllxml,uid_civ1]=add(civAllxml,1,'element','civ1');
     1815                [CivAllxml,uid_civ1]=add(CivAllxml,1,'element','civ1');
    18241816                for ilist=1:length(fieldnames)
    18251817                    val=eval(['str.' fieldnames{ilist}]);
    18261818                    if ischar(val)
    1827                         [civAllxml,uid_t]=add(civAllxml,uid_civ1,'element',fieldnames{ilist});
    1828                         [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val);
     1819                        [CivAllxml,uid_t]=add(CivAllxml,uid_civ1,'element',fieldnames{ilist});
     1820                        [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val);
    18291821                    end
    18301822                end
     
    18441836                maskname=name_generator(maskbase,num1_mask,1,'.png','_i');
    18451837            end
    1846             if isequal(civAll,0)
     1838            if CivX
    18471839                if isunix %unix system
    18481840                cmd_FIX=[sparam.FixBin ' -f ' filecell.nc.civ1{ifile,j} ' -fi1 ' num2str(flagindex1(1)) ...
     
    18561848                end
    18571849                cmd=[cmd cmd_FIX '\n'];
    1858             else
     1850            elseif CivAll
    18591851                fix1.inputFileName=filecell.nc.civ1{ifile,j} ;
    18601852                fix1.fi1=num2str(flagindex1(1));
     
    18641856                fix1.threshV=num2str(thresh_vel1);
    18651857                fieldnames=fields(fix1);
    1866                 [civAllxml,uid_fix1]=add(civAllxml,1,'element','fix1');
     1858                [CivAllxml,uid_fix1]=add(CivAllxml,1,'element','fix1');
    18671859                for ilist=1:length(fieldnames)
    18681860                    val=eval(['fix1.' fieldnames{ilist}]);
    18691861                    if ischar(val)
    1870                         [civAllxml,uid_t]=add(civAllxml,uid_fix1,'element',fieldnames{ilist});
    1871                         [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val);
     1862                        [CivAllxml,uid_t]=add(CivAllxml,uid_fix1,'element',fieldnames{ilist});
     1863                        [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val);
    18721864                    end
    18731865                end
    1874                 civAllCmd=[civAllCmd ' fix1 '];
     1866                CivAllCmd=[CivAllCmd ' fix1 '];
    18751867            end
    18761868        end
     
    18781870        %PATCH1
    18791871        if box_test(3)==1
    1880             if isequal(civAll,0)
     1872            if isequal(CivAll,0)
    18811873                cmd_PATCH=PATCH_CMD(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp,sparam.PatchBin);
    18821874                cmd=[cmd cmd_PATCH '\n'];
     
    19121904                patch1.convectFlow='n';
    19131905                fieldnames=fields(patch1);
    1914                 [civAllxml,uid_patch1]=add(civAllxml,1,'element','patch1');
     1906                [CivAllxml,uid_patch1]=add(CivAllxml,1,'element','patch1');
    19151907                for ilist=1:length(fieldnames)
    19161908                    val=eval(['patch1.' fieldnames{ilist}]);
    19171909                    if ischar(val)
    1918                         [civAllxml,uid_t]=add(civAllxml,uid_patch1,'element',fieldnames{ilist});
    1919                         [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val);
     1910                        [CivAllxml,uid_t]=add(CivAllxml,uid_patch1,'element',fieldnames{ilist});
     1911                        [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val);
    19201912                    end
    19211913                end
    1922                 civAllCmd=[civAllCmd ' patch1 '];
     1914                CivAllCmd=[CivAllCmd ' patch1 '];
    19231915            end
    19241916        end
     
    19871979            flname=fullfile(Rootbat,Filebat);
    19881980           
    1989             if isequal(civAll,0)
     1981            if isequal(CivAll,0)
    19901982                cmd_CIV2=CIV2_CMD(flname,[],par_civ2,sparam);%creates the cmx file [fullfile(Rootbat,Filebat) '.civ2.cmx]
    19911983%                 if(isunix)
     
    19961988%                 end
    19971989            else
    1998                 civAllCmd=[civAllCmd ' civ2 '];
     1990                CivAllCmd=[CivAllCmd ' civ2 '];
    19991991                str=CIV2_CMD_Unified(flname,'',par_civ2);
    20001992                fieldnames=fields(str);
    2001                 [civAllxml,uid_civ2]=add(civAllxml,1,'element','civ2');
     1993                [CivAllxml,uid_civ2]=add(CivAllxml,1,'element','civ2');
    20021994                for ilist=1:length(fieldnames)
    20031995                    val=eval(['str.' fieldnames{ilist}]);
    20041996                    if ischar(val)
    2005                         [civAllxml,uid_t]=add(civAllxml,uid_civ2,'element',fieldnames{ilist});
    2006                         [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val);
     1997                        [CivAllxml,uid_t]=add(CivAllxml,uid_civ2,'element',fieldnames{ilist});
     1998                        [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val);
    20071999                    end
    20082000                end
     
    20222014                maskname =name_generator(maskbase,num1_mask,1,'.png','_i');
    20232015            end
    2024             if isequal(civAll,0)
     2016            if isequal(CivAll,0)
    20252017                if isunix
    20262018                cmd_FIX=[sparam.FixBin ' -f ' filecell.nc.civ2{ifile,j} ' -fi1 ' num2str(flagindex2(1)) ...
     
    20422034                fix2.threshV=num2str(thresh_vel2);
    20432035                fieldnames=fields(fix2);
    2044                 [civAllxml,uid_fix2]=add(civAllxml,1,'element','fix2');
     2036                [CivAllxml,uid_fix2]=add(CivAllxml,1,'element','fix2');
    20452037                for ilist=1:length(fieldnames)
    20462038                    val=eval(['fix2.' fieldnames{ilist}]);
    20472039                    if ischar(val)
    2048                         [civAllxml,uid_t]=add(civAllxml,uid_fix2,'element',fieldnames{ilist});
    2049                         [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val);
     2040                        [CivAllxml,uid_t]=add(CivAllxml,uid_fix2,'element',fieldnames{ilist});
     2041                        [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val);
    20502042                    end
    20512043                end
    2052                 civAllCmd=[civAllCmd ' fix2 '];
     2044                CivAllCmd=[CivAllCmd ' fix2 '];
    20532045            end
    20542046        end
     
    20562048        %PATCH2
    20572049        if box_test(6)==1
    2058             if isequal(civAll,0)
     2050            if isequal(CivAll,0)
    20592051                cmd_PATCH=PATCH_CMD(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,test_interp,sparam.PatchBin);
    20602052                cmd=[cmd cmd_PATCH '\n'];
     
    20902082                patch2.convectFlow='n';
    20912083                fieldnames=fields(patch2);
    2092                 [civAllxml,uid_patch2]=add(civAllxml,1,'element','patch2');
     2084                [CivAllxml,uid_patch2]=add(CivAllxml,1,'element','patch2');
    20932085                for ilist=1:length(fieldnames)
    20942086                    val=eval(['patch2.' fieldnames{ilist}]);
    20952087                    if ischar(val)
    2096                         [civAllxml,uid_t]=add(civAllxml,uid_patch2,'element',fieldnames{ilist});
    2097                         [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val);
     2088                        [CivAllxml,uid_t]=add(CivAllxml,uid_patch2,'element',fieldnames{ilist});
     2089                        [CivAllxml,uid_t2]=add(CivAllxml,uid_t,'chardata',val);
    20982090                    end
    20992091                end
    2100                 civAllCmd=[civAllCmd ' patch2 '];
    2101             end
    2102         end
    2103         if isequal(civAll,1)
    2104             save(civAllxml,[flname '.xml']);
    2105             cmd=[cmd sparam.CivBin ' -f ' flname '.xml '  civAllCmd ' >' flname '.log' '\n'];
     2092                CivAllCmd=[CivAllCmd ' patch2 '];
     2093            end
     2094        end
     2095        if CivAll
     2096            save(CivAllxml,[flname '.xml']);
     2097            cmd=[cmd sparam.CivBin ' -f ' flname '.xml '  CivAllCmd ' >' flname '.log' '\n'];
    21062098        end
    21072099        % create the .bat file:
     
    21202112                    eval(  ['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' filename_bat]);
    21212113            end
    2122         elseif ~isequal(get(handles.CivAll,'Value'),3)
     2114        elseif ~CivUvmat
    21232115            %% to lauch the jobs locally :
    21242116            if(isunix)
     
    21302122            disp(cmd_str);
    21312123        else       %run PIVlab if selected
    2132             Data=civ_uvmat(par_civ1);
    2133 %             image1=imread(par_civ1.filename_ima_a);
    2134 %             image2=imread(par_civ1.filename_ima_b);     
    2135 %             stepx=str2num(par_civ1.dx);
    2136 %             stepy=str2num(par_civ1.dy);
    2137 %             ibx2=ceil(str2num(par_civ1.ibx)/2);
    2138 %             iby2=ceil(str2num(par_civ1.iby)/2);
    2139 %             isx2=ceil(str2num(par_civ1.isx)/2);
    2140 %             isy2=ceil(str2num(par_civ1.isy)/2);
    2141 %             shiftx=str2num(par_civ1.shiftx);
    2142 %             shifty=str2num(par_civ1.shifty);
    2143 % %             ibx=2*ibx2-1;%ibx and iby odd, reduced by 1 if even
    2144 % %             iby=2*iby2-1;
    2145 %             miniy=max(1+isy2-shifty,1+iby2);
    2146 %             minix=max(1+isx2-shiftx,1+ibx2);
    2147 %             maxiy=min(size(image1,1)-isy2-shifty,size(image1,1)-iby2);
    2148 %             maxix=min(size(image1,2)-isx2-shiftx,size(image1,2)-ibx2);
    2149 %             [GridX,GridY]=meshgrid(minix:stepx:maxix,miniy:stepy:maxiy);
    2150 %             PointCoord(:,1)=reshape(GridX,[],1);
    2151 %             PointCoord(:,2)=reshape(GridY,[],1);
    2152 %             % caluclate velocity data (y and v in indices, reverse to y component)
    2153 %             [xtable ytable utable vtable ctable typevector] = pivlab (image1,image2,ibx2,iby2,isx2,isy2,shiftx,shifty,PointCoord, 1, []);
    2154 %                Data.ListGlobalAttribute={'title','Time','Dt'};
    2155 %                Data.title='PIVlab';
    2156 %                Data.Time=str2double(par_civ1.T0);
    2157 %                Data.Dt=str2double(par_civ1.Dt);
    2158 %                Data.ListVarName={'X','Y','U','V','C','FF'};%  cell array containing the names of the fields to record
    2159 %                Data.VarDimName={'nbvec','nbvec','nbvec','nbvec','nbvec','nbvec'};
    2160 %                 Data.VarAttribute{1}.Role='coord_x';
    2161 %             Data.VarAttribute{2}.Role='coord_y';
    2162 %             Data.VarAttribute{3}.Role='vector_x';
    2163 %             Data.VarAttribute{4}.Role='vector_y';
    2164 %             Data.VarAttribute{5}.Role='errorflag';
    2165 %             Data.X=reshape(xtable,[],1);
    2166 %             Data.Y=reshape(size(image1,1)-ytable+1,[],1);
    2167 %             Data.U=reshape(utable,[],1);
    2168 %             Data.V=reshape(-vtable,[],1);
    2169 %             Data.C=reshape(ctable,[],1);
    2170 %             Data.FF=reshape(~typevector,[],1);
    2171             errormsg=struct2nc(filecell.nc.civ1{ifile,j},Data);
     2124            if box_test(1)==1
     2125                Param.Civ1=par_civ1;
     2126            end
     2127            if box_test(2)==1
     2128                fix1.WarnFlags=[];
     2129                if get(handles.vec_Fmin2,'Value')
     2130                    fix1.WarnFlags=[fix1.WarnFlags -2];
     2131                end
     2132                if get(handles.vec_F3,'Value')
     2133                    fix1.WarnFlags=[fix1.WarnFlags 3];
     2134                end
     2135                fix1.LowerBoundCorr=thresh_vecC1;
     2136                if get(handles.inf_sup1,'Value')
     2137                    fix1.UppperBoundVel=thresh_vel1;
     2138                else
     2139                     fix1.LowerBoundVel=thresh_vel1;
     2140                end
     2141                Param.Fix1=fix1;
     2142            end
     2143            if box_test(3)==1
     2144                Param.Patch1.Rho=rho_patch1;
     2145                Param.Patch1.Threshold=thresh_patch1;
     2146                Param.Patch1.SubDomain=subdomain_patch1;
     2147            end
     2148            [Data,erromsg]=civ_uvmat(Param,filecell.nc.civ1{ifile,j});
    21722149            if isempty(errormsg)
    21732150                display([filecell.nc.civ1{ifile,j} ' written'])
     
    21792156end
    21802157
    2181 if ~batch && ~isequal(get(handles.CivAll,'Value'),3)
     2158if ~batch && ~CivUvmat
    21822159    [Rootbat,Filebat,extbat]=fileparts(filename_bat);
    21832160    filename_superbat=fullfile(Rootbat,'job_list.bat');
     
    40063983end
    40073984par.rho=get(handles.rho,'String');
     3985if isequal(get(handles.rho,'Style'),'popupmenu')
     3986    index=get(handles.rho,'Value');
     3987    par.rho=par.rho{index};
     3988end
    40083989par.dx=get(handles.dx_civ1,'String');
    40093990par.dy=get(handles.dy_civ1,'String');
     
    43014282end
    43024283
    4303 %------------------------------------------------------------------------
    4304 % --- civ using pivlab
    4305 function Data=civ_uvmat(par_civ1)
    4306 %------------------------------------------------------------------------
    4307 image1=imread(par_civ1.filename_ima_a);
    4308 image2=imread(par_civ1.filename_ima_b);
    4309 stepx=str2num(par_civ1.dx);
    4310 stepy=str2num(par_civ1.dy);
    4311 ibx2=ceil(str2num(par_civ1.ibx)/2);
    4312 iby2=ceil(str2num(par_civ1.iby)/2);
    4313 isx2=ceil(str2num(par_civ1.isx)/2);
    4314 isy2=ceil(str2num(par_civ1.isy)/2);
    4315 shiftx=str2num(par_civ1.shiftx);
    4316 shifty=str2num(par_civ1.shifty);
    4317 miniy=max(1+isy2-shifty,1+iby2);
    4318 minix=max(1+isx2-shiftx,1+ibx2);
    4319 maxiy=min(size(image1,1)-isy2-shifty,size(image1,1)-iby2);
    4320 maxix=min(size(image1,2)-isx2-shiftx,size(image1,2)-ibx2);
    4321 [GridX,GridY]=meshgrid(minix:stepx:maxix,miniy:stepy:maxiy);
    4322 PointCoord(:,1)=reshape(GridX,[],1);
    4323 PointCoord(:,2)=reshape(GridY,[],1);
    4324 % caluclate velocity data (y and v in indices, reverse to y component)
    4325 [xtable ytable utable vtable ctable F] = pivlab (image1,image2,ibx2,iby2,isx2,isy2,shiftx,shifty,PointCoord, 1, []);
    4326 Data.ListGlobalAttribute=[{'Conventions','Program','CivStage'} {'Time','Dt'}];
    4327 Data.Conventions='uvmat/civdata';
    4328 Data.Program='civ_uvmat';
    4329 Data.CivStage=1;
    4330 % list_param=fieldnames(Param.Civ1);
    4331 % for ilist=1:length(list_param)
    4332 %     eval(['Data.Civ1_' list_param{ilist} '=Param.Civ1.' list_param{ilist} ';'])
    4333 % end
    4334 Data.Time=str2double(par_civ1.T0);
    4335 Data.Dt=str2double(par_civ1.Dt);
    4336 Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_C','Civ1_F'};%  cell array containing the names of the fields to record
    4337 Data.VarDimName={'nbvec','nbvec','nbvec','nbvec','nbvec','nbvec'};
    4338 Data.VarAttribute{1}.Role='coord_x';
    4339 Data.VarAttribute{2}.Role='coord_y';
    4340 Data.VarAttribute{3}.Role='vector_x';
    4341 Data.VarAttribute{4}.Role='vector_y';
    4342 Data.VarAttribute{5}.Role='warnflag';
    4343 Data.Civ1_X=reshape(xtable,[],1);
    4344 Data.Civ1_Y=reshape(size(image1,1)-ytable+1,[],1);
    4345 Data.Civ1_U=reshape(utable,[],1);
    4346 Data.Civ1_V=reshape(-vtable,[],1);
    4347 Data.Civ1_C=reshape(ctable,[],1);
    4348 Data.Civ1_F=reshape(F,[],1);
     4284% %------------------------------------------------------------------------
     4285% % --- civ using pivlab
     4286% function Data=civ_uvmat(par_civ1)
     4287% %------------------------------------------------------------------------
     4288% image1=imread(par_civ1.filename_ima_a);
     4289% image2=imread(par_civ1.filename_ima_b);
     4290% stepx=str2num(par_civ1.dx);
     4291% stepy=str2num(par_civ1.dy);
     4292% ibx2=ceil(str2num(par_civ1.ibx)/2);
     4293% iby2=ceil(str2num(par_civ1.iby)/2);
     4294% isx2=ceil(str2num(par_civ1.isx)/2);
     4295% isy2=ceil(str2num(par_civ1.isy)/2);
     4296% shiftx=str2num(par_civ1.shiftx);
     4297% shifty=str2num(par_civ1.shifty);
     4298% miniy=max(1+isy2-shifty,1+iby2);
     4299% minix=max(1+isx2-shiftx,1+ibx2);
     4300% maxiy=min(size(image1,1)-isy2-shifty,size(image1,1)-iby2);
     4301% maxix=min(size(image1,2)-isx2-shiftx,size(image1,2)-ibx2);
     4302% [GridX,GridY]=meshgrid(minix:stepx:maxix,miniy:stepy:maxiy);
     4303% PointCoord(:,1)=reshape(GridX,[],1);
     4304% PointCoord(:,2)=reshape(GridY,[],1);
     4305% % caluclate velocity data (y and v in indices, reverse to y component)
     4306% [xtable ytable utable vtable ctable F] = pivlab (image1,image2,ibx2,iby2,isx2,isy2,shiftx,shifty,PointCoord, 1, []);
     4307% Data.ListGlobalAttribute=[{'Conventions','Program','CivStage'} {'Time','Dt'}];
     4308% Data.Conventions='uvmat/civdata';
     4309% Data.Program='civ_uvmat';
     4310% Data.CivStage=1;
     4311% % list_param=fieldnames(Param.Civ1);
     4312% % for ilist=1:length(list_param)
     4313% %     eval(['Data.Civ1_' list_param{ilist} '=Param.Civ1.' list_param{ilist} ';'])
     4314% % end
     4315% Data.Time=str2double(par_civ1.T0);
     4316% Data.Dt=str2double(par_civ1.Dt);
     4317% Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_C','Civ1_F'};%  cell array containing the names of the fields to record
     4318% Data.VarDimName={'nbvec','nbvec','nbvec','nbvec','nbvec','nbvec'};
     4319% Data.VarAttribute{1}.Role='coord_x';
     4320% Data.VarAttribute{2}.Role='coord_y';
     4321% Data.VarAttribute{3}.Role='vector_x';
     4322% Data.VarAttribute{4}.Role='vector_y';
     4323% Data.VarAttribute{5}.Role='warnflag';
     4324% Data.Civ1_X=reshape(xtable,[],1);
     4325% Data.Civ1_Y=reshape(size(image1,1)-ytable+1,[],1);
     4326% Data.Civ1_U=reshape(utable,[],1);
     4327% Data.Civ1_V=reshape(-vtable,[],1);
     4328% Data.Civ1_C=reshape(ctable,[],1);
     4329% Data.Civ1_F=reshape(F,[],1);
    43494330
    43504331%------------------------------------------------------------------------
     
    49184899% --- Executes on button press in CivAll.
    49194900function CivAll_Callback(hObject, eventdata, handles)
    4920 if get(handles.CivAll,'Value')==2
    4921     if get(handles.PATCH1,'Value')
    4922         set(handles.thresh_patch1,'Visible','on')
    4923         set(handles.thresh_text1,'Visible','on')
    4924     end
    4925 else
    4926     set(handles.thresh_patch1,'Visible','off')
    4927     set(handles.thresh_text1,'Visible','off')
    4928 end
    4929 
     4901Listprog=get(handles.CivAll,'String');
     4902index=get(handles.CivAll,'Value');
     4903prog=Listprog{index};
     4904switch prog
     4905    case 'CivX'
     4906        set(handles.thresh_patch1,'Visible','off')
     4907        set(handles.thresh_text1,'Visible','off')
     4908        set(handles.rho,'Style','edit')
     4909        set(handles.rho,'String','1')
     4910    case 'CivAll'
     4911        if get(handles.PATCH1,'Value')
     4912            set(handles.thresh_patch1,'Visible','on')
     4913            set(handles.thresh_text1,'Visible','on')
     4914        end
     4915        set(handles.rho,'Style','edit')
     4916        set(handles.rho,'String','1')
     4917    case 'CivUvmat'
     4918        if get(handles.PATCH1,'Value')
     4919            set(handles.thresh_patch1,'Visible','on')
     4920            set(handles.thresh_text1,'Visible','on')
     4921        end
     4922        set(handles.rho,'Style','popupmenu')
     4923        set(handles.rho,'Value',1)
     4924        set(handles.rho,'String',{'1';'2'})
     4925end
     4926
Note: See TracChangeset for help on using the changeset viewer.