Changeset 421 for trunk/src/uvmat.m
- Timestamp:
- May 14, 2012, 7:03:14 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r415 r421 411 411 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 412 412 oldfile=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 413 % oldfile=read_file_box,es(handles);414 413 if isempty(oldfile)||isequal(oldfile,'') %loads the previously stored file name and set it as default in the file_input box 415 414 dir_perso=prefdir; … … 422 421 end 423 422 end 424 [FileName, PathName] = uigetfile( ... 425 {'*.xml;*.xls;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol;*.nc;*.cmx;*.fig;*.log;*.dat;*.bat;', ' (*.xml,*.xls,*.civ,*.jpg ,*.png, .tif, *.avi,*.vol,*.nc,*.cmx,*.fig,*.log,*.dat,*.bat)'; 426 '*.xml', '.xml files '; ... 427 '*.xls', '.xls files '; ... 428 '*.civ', '.civ files '; ... 429 '*.jpg',' jpeg image files'; ... 430 '*.png','.png image files'; ... 431 '*.tif','.tif image files'; ... 432 '*.avi;*.AVI','.avi movie files'; ... 433 '*.vol','.volume images (png)'; ... 434 '*.nc','.netcdf files'; ... 435 '*.cdf','.netcdf files'; ... 436 '*.cmx','.cmx text files ';... 437 '*.fig','.fig files (matlab fig)';... 438 '*.log','.log text files ';... 439 '*.dat','.dat text files ';... 440 '*.bat','.bat system command text files';... 441 '*.*', 'All Files (*.*)'}, ... 442 'Pick a file',oldfile); 423 % [FileName, PathName] = uigetfile( ... 424 % {'*.xml;*.xls;*.civ;*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol;*.nc;*.cmx;*.fig;*.log;*.dat;*.bat;', ' (*.xml,*.xls,*.civ,*.jpg ,*.png, .tif, *.avi,*.vol,*.nc,*.cmx,*.fig,*.log,*.dat,*.bat)'; 425 % '*.xml', '.xml files '; ... 426 % '*.xls', '.xls files '; ... 427 % '*.civ', '.civ files '; ... 428 % '*.jpg',' jpeg image files'; ... 429 % '*.png','.png image files'; ... 430 % '*.tif','.tif image files'; ... 431 % '*.avi;*.AVI','.avi movie files'; ... 432 % '*.vol','.volume images (png)'; ... 433 % '*.nc','.netcdf files'; ... 434 % '*.cdf','.netcdf files'; ... 435 % '*.cmx','.cmx text files ';... 436 % '*.fig','.fig files (matlab fig)';... 437 % '*.log','.log text files ';... 438 % '*.dat','.dat text files ';... 439 % '*.bat','.bat system command text files';... 440 % '*.*', 'All Files (*.*)'}, ... 441 % 'Pick a file',oldfile); 442 443 [FileName, PathName] = uigetfile({'*.*','All Files(*.*)'},'Pick a file',oldfile); 443 444 fileinput=[PathName FileName];%complete file name 444 445 sizf=size(fileinput); … … 488 489 function MenuBrowse_1_Callback(hObject, eventdata, handles) 489 490 %------------------------------------------------------------------------ 490 % huvmat=get(handles.run0,'parent');491 UvData=get(handles.uvmat,'UserData');492 493 491 RootPath=get(handles.RootPath,'String'); 494 [FileName, PathName, filterindex] = uigetfile( ... 495 {'*.xml;*.xls;*.civ;*.jpg;*.png;*.avi;*.AVI;*.nc;*.cmx;*.fig;*.log;*.dat', ' (*.xml,*.xls,*.civ, *.jpg,*.png, *.avi,*.nc,*.cmx ,*.fig,*.log,*.dat)'; 496 '*.xml', '.xml files '; ... 497 '*.xls', '.xls files '; ... 498 '*.civ', '.civ files '; ... 499 '*.jpg','.jpg image files'; ... 500 '*.png','.png image files'; ... 501 '*.avi;*.AVI','.avi movie files'; ... 502 '*.nc','.netcdf files'; ... 503 '*.cdf','.netcdf files'; ... 504 '*.cmx','.cmx text files';... 505 '*.cmx2','.cmx2 text files';... 506 '*.fig','.fig files (matlab fig)';... 507 '*.log','.log text files ';... 508 '*.dat','.dat text files ';... 509 '*.*', 'All Files (*.*)'}, ... 510 'Pick a second file for comparison',RootPath); 492 % [FileName, PathName, filterindex] = uigetfile( ... 493 % {'*.xml;*.xls;*.civ;*.jpg;*.png;*.avi;*.AVI;*.nc;*.cmx;*.fig;*.log;*.dat', ' (*.xml,*.xls,*.civ, *.jpg,*.png, *.avi,*.nc,*.cmx ,*.fig,*.log,*.dat)'; 494 % '*.xml', '.xml files '; ... 495 % '*.xls', '.xls files '; ... 496 % '*.civ', '.civ files '; ... 497 % '*.jpg','.jpg image files'; ... 498 % '*.png','.png image files'; ... 499 % '*.avi;*.AVI','.avi movie files'; ... 500 % '*.nc','.netcdf files'; ... 501 % '*.cdf','.netcdf files'; ... 502 % '*.cmx','.cmx text files';... 503 % '*.cmx2','.cmx2 text files';... 504 % '*.fig','.fig files (matlab fig)';... 505 % '*.log','.log text files ';... 506 % '*.dat','.dat text files ';... 507 % '*.*', 'All Files (*.*)'}, ... 508 % 'Pick a second file for comparison',RootPath); 509 [FileName, PathName] = uigetfile({'*.*','All Files(*.*)'},'Pick a file',RootPath); 511 510 fileinput_1=[PathName FileName];%complete file name 512 511 sizf=size(fileinput_1); … … 1997 1996 1998 1997 %% read the first input field if a filename has been introduced 1998 ParamIn.ColorVar='';%default variable name for vector color 1999 1999 if ~isempty(filename) 2000 2000 ObjectName=filename; … … 2350 2350 2351 2351 %% calculate scalar 2352 if (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx'))%&&~strcmp(ParamOut.FieldName,'velocity')&& ~strcmp(ParamOut.FieldName,'get_field...');% ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)%2352 if ~strcmp(ParamOut.FieldName,'get_field...')&& (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx'))%&&~strcmp(ParamOut.FieldName,'velocity')&& ~strcmp(ParamOut.FieldName,'get_field...');% ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)% 2353 2353 Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1}); 2354 2354 end 2355 if numel(Field)==2 && ~ test_keepdata_1 && (strcmp(UvData.FileType{2},'civdata')||strcmp(UvData.FileType{2},'civx')) &&~strcmp(ParamOut_1.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...')2355 if numel(Field)==2 && ~strcmp(ParamOut_1.FieldName,'get_field...')&& ~test_keepdata_1 && (strcmp(UvData.FileType{2},'civdata')||strcmp(UvData.FileType{2},'civx')) &&~strcmp(ParamOut_1.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...') 2356 2356 Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2}); 2357 2357 end … … 2386 2386 return 2387 2387 end 2388 [NbDim,imax]=max(NbDim); 2388 [NbDim,imax]=max(NbDim);% spatial dimension of the input field 2389 2389 if isfield(UvData.Field,'NbDim') 2390 2390 NbDim=UvData.Field.NbDim;% deal with plane fields containing z coordinates 2391 2391 end 2392 XName=''; %default 2393 YName=''; 2392 2394 if ~isempty(VarType{imax}.coord_x) && ~isempty(VarType{imax}.coord_y) %unstructured coordinates 2393 2395 XName=UvData.Field.ListVarName{VarType{imax}.coord_x}; 2394 2396 YName=UvData.Field.ListVarName{VarType{imax}.coord_y}; 2395 eval(['nbvec=length(UvData.Field.' XName ');'])%nbre of measurement points (e.g. vectors)2397 nbvec=length(UvData.Field.(XName));%nbre of measurement points (e.g. vectors) 2396 2398 test_x=1;%test for unstructured coordinates 2397 2399 if ~isempty(VarType{imax}.coord_z) … … 2402 2404 elseif numel(VarType)>=imax && numel(VarType{imax}.coord)>=NbDim && VarType{imax}.coord(NbDim)>0 %structured coordinate 2403 2405 XName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim)}; 2404 if NbDim> 12406 if NbDim> 1 && VarType{imax}.coord(NbDim-1)>0 2405 2407 YName=UvData.Field.ListVarName{VarType{imax}.coord(NbDim-1)}; %structured coordinates 2406 2408 end 2409 VarIndex=CellVarIndex{imax}; % list of variable indices 2410 DimIndex=VarDimIndex{VarIndex(1)}; %list of dim indices for the variable 2411 nbpoints_x=DimValue(DimIndex(NbDim)); 2412 XMax=nbpoints_x;%default 2413 XMin=1;%default 2407 2414 end 2408 2415 if NbDim==3 … … 2420 2427 end 2421 2428 end 2422 if exist('XName','var') 2423 eval(['XMax=max(max(UvData.Field.' XName '));']) 2424 eval(['XMin=min(min(UvData.Field.' XName '));']) 2429 2430 if ~isempty (XName) 2431 XMax=max(max(UvData.Field.(XName))); 2432 XMin=min(min(UvData.Field.(XName))); 2425 2433 UvData.Field.NbDim=NbDim; 2426 2434 UvData.Field.XMax=XMax; 2427 2435 UvData.Field.XMin=XMin; 2428 if NbDim >1 2429 eval(['YMax=max(max(UvData.Field.' YName '));'])2430 eval(['YMin=min(min(UvData.Field.' YName '));'])2436 if NbDim >1&& ~isempty(YName) 2437 YMax=max(max(UvData.Field.(YName))); 2438 YMin=min(min(UvData.Field.(YName))); 2431 2439 UvData.Field.YMax=YMax; 2432 UvData.Field.YMin=YMin; 2433 end 2434 eval(['nbvec=length(UvData.Field.' XName ');'])2440 UvData.Field.YMin=YMin; 2441 end 2442 nbvec=length(UvData.Field.(XName)); 2435 2443 if test_x %unstructured coordinates 2436 2444 if test_z … … 2440 2448 UvData.Field.Mesh=sqrt((XMax-XMin)*(YMax-YMin)/nbvec);%2D 2441 2449 end 2450 end 2451 end 2452 if ~test_x 2453 % VarIndex=CellVarIndex{imax}; % list of variable indices 2454 % DimIndex=VarDimIndex{VarIndex(1)}; %list of dim indices for the variable 2455 % nbpoints_x=DimValue(DimIndex(NbDim)); 2456 DX=(XMax-XMin)/(nbpoints_x-1); 2457 if NbDim >1 2458 nbpoints_y=DimValue(DimIndex(NbDim-1)); 2459 if isempty(YName)% if the y coordinate is not expressed, it is taken as the matrix index 2460 DY=1; 2461 UvData.Field.YMax=nbpoints_y; 2462 UvData.Field.YMin=1; 2463 else 2464 DY=(YMax-YMin)/(nbpoints_y-1); 2465 end 2466 end 2467 if NbDim==3 2468 nbpoints_z=DimValue(DimIndex(1)); 2469 DZ=(ZMax-ZMin)/(nbpoints_z-1); 2470 UvData.Field.Mesh=(DX*DY*DZ)^(1/3); 2471 UvData.Field.ZMax=ZMax; 2472 UvData.Field.ZMin=ZMin; 2442 2473 else 2443 VarIndex=CellVarIndex{imax}; % list of variable indices 2444 DimIndex=VarDimIndex{VarIndex(1)}; %list of dim indices for the variable 2445 nbpoints_x=DimValue(DimIndex(NbDim)); 2446 DX=(XMax-XMin)/(nbpoints_x-1); 2447 if NbDim >1 2448 nbpoints_y=DimValue(DimIndex(NbDim-1)); 2449 DY=(YMax-YMin)/(nbpoints_y-1); 2450 end 2451 if NbDim==3 2452 nbpoints_z=DimValue(DimIndex(1)); 2453 DZ=(ZMax-ZMin)/(nbpoints_z-1); 2454 UvData.Field.Mesh=(DX*DY*DZ)^(1/3); 2455 UvData.Field.ZMax=ZMax; 2456 UvData.Field.ZMin=ZMin; 2457 else 2458 UvData.Field.Mesh=DX;%sqrt(DX*DY); 2459 end 2460 end 2461 % adjust the mesh to a value 1, 2 , 5 *10^n 2462 ord=10^(floor(log10(UvData.Field.Mesh)));%order of magnitude 2463 if UvData.Field.Mesh/ord>=5 2464 UvData.Field.Mesh=5*ord; 2465 elseif UvData.Field.Mesh/ord>=2 2466 UvData.Field.Mesh=2*ord; 2467 else 2468 UvData.Field.Mesh=ord; 2469 end 2470 end 2474 UvData.Field.Mesh=DX;%sqrt(DX*DY); 2475 end 2476 end 2477 % adjust the mesh to a value 1, 2 , 5 *10^n 2478 ord=10^(floor(log10(UvData.Field.Mesh)));%order of magnitude 2479 if UvData.Field.Mesh/ord>=5 2480 UvData.Field.Mesh=5*ord; 2481 elseif UvData.Field.Mesh/ord>=2 2482 UvData.Field.Mesh=2*ord; 2483 else 2484 UvData.Field.Mesh=ord; 2485 end 2486 2471 2487 2472 2488 %% 3D case (menuvolume) … … 2560 2576 %PlotParam{1}=read_plot_param(handles);%read plotting parameters on the uvmat interfac 2561 2577 PlotParam{1}=read_GUI(handles.uvmat); 2562 %default settings if vectors not visible (should not be needed)2578 %default settings if vectors not visible 2563 2579 if ~isfield(PlotParam{1},'Vectors') 2564 2580 PlotParam{1}.Vectors.MaxVec=1; … … 2595 2611 return 2596 2612 end 2597 if testnewseries && isfield(ObjectData,'CoordUnit') 2613 if testnewseries 2614 PlotParam{imap}.Scalar.CheckBW=[]; %B/W option depends on the input field (image or scalar) 2615 if isfield(ObjectData,'CoordUnit') 2598 2616 PlotParam{imap}.Coordinates.CheckFixEqual=1;% set x and y scaling equal if CoordUnit is defined (common unit for x and y) 2617 end 2599 2618 end 2600 2619 %use of mask (TODO: check) … … 4425 4444 hset_object=set_object(data,handles);% call the set_object interface 4426 4445 hhset_object=guidata(hset_object); 4427 set(hhset_object.PLOT,'enable','on')% activate the refresh button 4446 hchild=get(hset_object,'children'); 4447 set(hchild,'enable','on') 4448 %set(hhset_object.PLOT,'enable','on')% activate the refresh button 4428 4449 %set(handles.MenuObject,'checked','on') 4429 4450 set(handles.uvmat,'UserData',UvData)
Note: See TracChangeset
for help on using the changeset viewer.