Changeset 576 for trunk/src/civ.m


Ignore:
Timestamp:
Mar 4, 2013, 8:13:53 AM (11 years ago)
Author:
sommeria
Message:

grid improved for civ: computation done closer to the edge. set_grid improved.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r575 r576  
    33263326%------------------------------------------------------------------------
    33273327% --- function called to look for grid files
    3328 function [nbslice, flag_mask]=get_grid(filebase,handles)
    3329 %------------------------------------------------------------------------
    3330 flag_mask=0;%default
     3328function [nbslice, flag_grid]=get_grid(filebase,handles)
     3329%------------------------------------------------------------------------
     3330flag_grid=0;%default
    33313331nbslice=1;
    33323332[Path,Name]=fileparts(filebase);
    33333333currentdir=pwd;
    33343334cd(Path);%move in the dir of the root name filebase
    3335 maskfiles=dir([Name '_*grid_*.grid']);%look for mask files
     3335gridfiles=dir([Name '_*grid_*.grid']);%look for grid files
    33363336cd(currentdir);%come back to the current working directory
    3337 if ~isempty(maskfiles)
    3338     flag_mask=1;
    3339     maskname=maskfiles(1).name;% take the first mask file in the list
    3340     [Path2,Name,ext]=fileparts(maskname);
     3337if ~isempty(gridfiles)
     3338    flag_grid=1;
     3339    gridname=gridfiles(1).name;% take the first grid file in the list
     3340    [Path2,Name,ext]=fileparts(gridname);
    33413341    Namedouble=double(Name);
    33423342    val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters
    3343     ind_mask=findstr('grid',Name);
    3344     i=ind_mask-1;
     3343    ind_grid=findstr('grid',Name);
     3344    i=ind_grid-1;
    33453345    while val(i)==0 && i>0
    33463346        i=i-1;
    33473347    end
    3348     nbslice=str2double(Name(i+1:ind_mask-1));
     3348    nbslice=str2double(Name(i+1:ind_grid-1));
    33493349    if ~isnan(nbslice) && Name(i)=='_'
    3350         flag_mask=1;
     3350        flag_grid=1;
    33513351    else
    33523352        msgbox_uvmat('ERROR',['bad grid file ' Name ext ' found in ' Path2])
     
    34153415%------------------------------------------------------------------------
    34163416value=get(hObject,'Value');
    3417 hparent=get(hObject,'parent');
     3417hparent=get(hObject,'parent');%handles of the parent panel
    34183418hchildren=get(hparent,'children');
    3419 handle_txtbox=findobj(hchildren,'tag','txt_Grid');
     3419handle_txtbox=findobj(hchildren,'tag','Grid');% look for the grid name box in the same panel
    34203420handle_dx=findobj(hchildren,'tag','num_Dx');
    34213421handle_dy=findobj(hchildren,'tag','num_Dy');
     
    34353435            filebase=filegrid;
    34363436        end
    3437         [FileName, PathName, filterindex] = uigetfile( ...
     3437        [FileName, PathName] = uigetfile( ...
    34383438            {'*.grid', ' (*.grid)';
    34393439            '*.grid',  '.grid files '; ...
     
    34683468    hchildren=get(handles.Civ2,'children');
    34693469    handle_checkbox=findobj(hchildren,'tag','CheckGrid');
    3470     handle_txtbox=findobj(hchildren,'tag','txt_Grid');
     3470    handle_txtbox=findobj(hchildren,'tag','Grid');
    34713471    handle_dx=findobj(hchildren,'tag','num_Dx');
    34723472    handle_dy=findobj(hchildren,'tag','num_Dy');
     
    34823482        set(handle_txtbox,'Visible','on')
    34833483        set(handle_txtbox,'String',filegrid)
    3484 %     else
    3485 %         set(handle_checkbox,'Value',0);
    3486 %         set(handles.CheckGrid,'Value',0);
    3487 %         set(handle_dx,'Visible','on');
    3488 %         set(handle_dy,'Visible','on');
    3489 %          set(handle_title_dx,'Visible','on');
    3490 %         set(handle_title_dy,'Visible','on');
    3491 %         set(handle_txtbox,'Visible','off')
    34923484    end
    34933485end
     
    35323524    set(handles.CheckMask,'Value',1)
    35333525    end
    3534 %     switch parent_tag
    3535 % %         case 'Fix1'
    3536 % %             stage=2;
    3537 %         case 'Civ2'
    3538 %              stage=3;
    3539 % %         case 'Fix2'
    3540 % %             stage=4;
    3541 %     end
    3542 %     set(handles.Mask(stage:end),'Visible','on')
    3543 %     set(handles.Mask(stage:end),'String',filemask)
    3544 %     set(handles.CheckMask(stage:end),'Value',1)
    35453526else
    35463527    set(hObject,'Value',0);
     
    35483529end
    35493530
    3550 
     3531%------------------------------------------------------------------------
    35513532% --- Executes on button press in get_gridpatch1.
    35523533function get_gridpatch1_Callback(hObject, eventdata, handles)
     3534%------------------------------------------------------------------------
    35533535filebase=get(handles.RootPath,'String');
    35543536[FileName, PathName, filterindex] = uigetfile( ...
Note: See TracChangeset for help on using the changeset viewer.