Changeset 89 for trunk/src/civ.m


Ignore:
Timestamp:
May 20, 2010, 1:48:25 AM (14 years ago)
Author:
sommeria
Message:

many bug corrections and cleaning. Activation of the BW option in uvmat. Improvement of the interaction of get_field with uvmat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r87 r89  
    181181
    182182% set the range of fields (1:1 by default) and selected pair
    183 if isempty(num2)||isequal(num2,num1)
     183if isnan(num2)||isequal(num2,num1)
    184184    num_ref_i=num1;
    185185else
     
    188188    browse.incr_pair(2)=0;
    189189end
    190 if isempty(num_b)||isequal(num_a,num_b)
    191     if isempty(num_a)
     190if isnan(num_b)||isequal(num_a,num_b)
     191    if isnan(num_a)
    192192        num_ref_j=1;
    193193    else
     
    291291[RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput);
    292292filebase=fullfile(RootPath,RootFile);
    293 num_i1=stra2num(str1);
    294 if isempty(num_i1),num_i1=1;end
    295 num_i2=stra2num(str2);
    296 if isempty(num_i2),num_i2=num_i1;end
     293num_i1=str2double(str1);
     294if isnan(num_i1),num_i1=1;end
     295num_i2=str2double(str2);
     296if isnan(num_i2),num_i2=num_i1;end
    297297num_j1=stra2num(str_a);
    298 if isempty(num_j1),num_j1=1;end
     298if isnan(num_j1),num_j1=1;end
    299299num_j2=stra2num(str_b);
    300 if isempty(num_j2),num_j2=num_j1;end
     300if isnan(num_j2),num_j2=num_j1;end
    301301if isequal(get(handles.compare,'Value'),1)
    302302    browse=[];%initialisation
     
    615615    end
    616616end   
    617    
    618617% no image documentation file found: look for a series of existing images or .nc files
    619618if isempty(time) && ~isequal(ext,'.nc') && ~strcmp(nom_type_ima,'none') && ~strcmp(nom_type_ima,'') && ~strcmp(nom_type_ima,'*')
     
    646645    end
    647646    first_i=max(field_i,1);
    648         %determine the set of times and possible intervals for CIV
     647
     648    if strcmp(nom_type_ima,'_i_j')
     649        field_i=field_count;
     650        field_j=1;
     651        jdetect=1;
     652        while jdetect==1 %look for the maximum file number in the series
     653            imagename=name_generator(filebase,field_i,field_j,ext_ima,nom_type_ima);
     654            jdetect=(exist(imagename,'file')==2);
     655            if jdetect
     656                field_j=field_j+1;
     657            end
     658            %SEE CASE OF NETCDF FILES
     659            %             nbdetect=nbdetect+(exist(imagename,'file')==2);
     660        end
     661        nb_field_j=field_j-1;% last detected field number
     662    end
     663
     664   
     665    %determine the set of times and possible intervals for CIV
    649666 %   dt=(1/1000)*str2num(get(handles.dt,'String'));
    650667    time=[0:nb_field-1]';% time=file index -1  by default
     668    if strcmp(nom_type_ima,'_i_j')
     669       % time=[0:nb_field-1]'*ones(1,nb_field_j);% time=file index -1  by default
     670       time=[0:nb_field-1]'*[0:nb_field_j-1];% time=file index -1  by default
     671    end
     672 
     673
    651674    set(handles.mode,'String',{'series(Di)'})
    652675end
     
    26622685        filename_bat(end-2:end)='bat';
    26632686        fid=fopen(filename_bat,'w');
     2687         
    26642688        fprintf(fid,cmd);
    26652689        fclose(fid);
     
    51525176ref.num_a=stra2num(str_a);
    51535177ref.num_b=stra2num(str_b);
    5154 ref.num1=str2num(field_count);
    5155 ref.num2=str2num(str2);
     5178ref.num1=str2double(field_count);
     5179ref.num2=str2double(str2);
    51565180browse=[];%initialisation
    51575181if ~isequal(ref.ext,'.nc')
     
    52485272set(handles.thresh_vel2,'String','0');
    52495273
    5250 %------------------------------------------------------------------------
    5251 % transform letters to numbers
    5252 function numres=stra2num(str)
    5253 %------------------------------------------------------------------------
    5254 numres=double(str)-96;
    5255 if double(str) >= 48 & double(str) <= 57 % = 1 for numbers
    5256     numres=str2num(str);
    5257 end
     5274% %------------------------------------------------------------------------
     5275% % transform letters to numbers
     5276% function numres=stra2num(str)
     5277% %------------------------------------------------------------------------
     5278% numres=double(str)-96;
     5279% if double(str) >= 48 & double(str) <= 57 % = 1 for numbers
     5280%     numres=str2num(str);
     5281% end
    52585282
    52595283%------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.