Changeset 576 for trunk/src/civ.m
- Timestamp:
- Mar 4, 2013, 8:13:53 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r575 r576 3326 3326 %------------------------------------------------------------------------ 3327 3327 % --- function called to look for grid files 3328 function [nbslice, flag_ mask]=get_grid(filebase,handles)3329 %------------------------------------------------------------------------ 3330 flag_ mask=0;%default3328 function [nbslice, flag_grid]=get_grid(filebase,handles) 3329 %------------------------------------------------------------------------ 3330 flag_grid=0;%default 3331 3331 nbslice=1; 3332 3332 [Path,Name]=fileparts(filebase); 3333 3333 currentdir=pwd; 3334 3334 cd(Path);%move in the dir of the root name filebase 3335 maskfiles=dir([Name '_*grid_*.grid']);%look for maskfiles3335 gridfiles=dir([Name '_*grid_*.grid']);%look for grid files 3336 3336 cd(currentdir);%come back to the current working directory 3337 if ~isempty( maskfiles)3338 flag_ mask=1;3339 maskname=maskfiles(1).name;% take the first maskfile in the list3340 [Path2,Name,ext]=fileparts( maskname);3337 if ~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); 3341 3341 Namedouble=double(Name); 3342 3342 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; 3345 3345 while val(i)==0 && i>0 3346 3346 i=i-1; 3347 3347 end 3348 nbslice=str2double(Name(i+1:ind_ mask-1));3348 nbslice=str2double(Name(i+1:ind_grid-1)); 3349 3349 if ~isnan(nbslice) && Name(i)=='_' 3350 flag_ mask=1;3350 flag_grid=1; 3351 3351 else 3352 3352 msgbox_uvmat('ERROR',['bad grid file ' Name ext ' found in ' Path2]) … … 3415 3415 %------------------------------------------------------------------------ 3416 3416 value=get(hObject,'Value'); 3417 hparent=get(hObject,'parent'); 3417 hparent=get(hObject,'parent');%handles of the parent panel 3418 3418 hchildren=get(hparent,'children'); 3419 handle_txtbox=findobj(hchildren,'tag',' txt_Grid');3419 handle_txtbox=findobj(hchildren,'tag','Grid');% look for the grid name box in the same panel 3420 3420 handle_dx=findobj(hchildren,'tag','num_Dx'); 3421 3421 handle_dy=findobj(hchildren,'tag','num_Dy'); … … 3435 3435 filebase=filegrid; 3436 3436 end 3437 [FileName, PathName , filterindex] = uigetfile( ...3437 [FileName, PathName] = uigetfile( ... 3438 3438 {'*.grid', ' (*.grid)'; 3439 3439 '*.grid', '.grid files '; ... … … 3468 3468 hchildren=get(handles.Civ2,'children'); 3469 3469 handle_checkbox=findobj(hchildren,'tag','CheckGrid'); 3470 handle_txtbox=findobj(hchildren,'tag',' txt_Grid');3470 handle_txtbox=findobj(hchildren,'tag','Grid'); 3471 3471 handle_dx=findobj(hchildren,'tag','num_Dx'); 3472 3472 handle_dy=findobj(hchildren,'tag','num_Dy'); … … 3482 3482 set(handle_txtbox,'Visible','on') 3483 3483 set(handle_txtbox,'String',filegrid) 3484 % else3485 % 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')3492 3484 end 3493 3485 end … … 3532 3524 set(handles.CheckMask,'Value',1) 3533 3525 end 3534 % switch parent_tag3535 % % case 'Fix1'3536 % % stage=2;3537 % case 'Civ2'3538 % stage=3;3539 % % case 'Fix2'3540 % % stage=4;3541 % end3542 % set(handles.Mask(stage:end),'Visible','on')3543 % set(handles.Mask(stage:end),'String',filemask)3544 % set(handles.CheckMask(stage:end),'Value',1)3545 3526 else 3546 3527 set(hObject,'Value',0); … … 3548 3529 end 3549 3530 3550 3531 %------------------------------------------------------------------------ 3551 3532 % --- Executes on button press in get_gridpatch1. 3552 3533 function get_gridpatch1_Callback(hObject, eventdata, handles) 3534 %------------------------------------------------------------------------ 3553 3535 filebase=get(handles.RootPath,'String'); 3554 3536 [FileName, PathName, filterindex] = uigetfile( ...
Note: See TracChangeset
for help on using the changeset viewer.