Changeset 1199 for trunk/src/uvmat.m
- Timestamp:
- Mar 18, 2026, 12:44:56 PM (3 hours ago)
- File:
-
- 1 edited
-
trunk/src/uvmat.m (modified) (35 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r1196 r1199 253 253 for ilist=1:length(h.export_fct) 254 254 if exist(h.export_fct{ilist},'file')==2 255 [ path,file]=fileparts(h.export_fct{ilist});255 [~,file]=fileparts(h.export_fct{ilist}); 256 256 export_menu=[export_menu; {file}]; 257 257 end … … 265 265 set(handles.TransformPath,'UserData',[]) 266 266 export_menu=[export_menu;{'more...'}];%append the option more.. to the menu 267 %set(handles.TransformName,'String',transform_menu)% display the menu of transform fcts268 267 269 268 %% case of an input argument for uvmat 270 %testinputfield=0;271 269 inputfile=[]; 272 %Field=[];273 270 if exist('input','var') 274 271 if ishandle(handles.UVMAT_title) … … 356 353 357 354 %------------------------------------------------------------------------ 358 %--- activated when resizing the GUI view_field355 %--- activated when resizing the GUI uvmat 359 356 function ResizeFcn(gcbo,eventdata,handles) 360 357 %------------------------------------------------------------------------ 361 358 set(handles.uvmat,'Units','pixels') 362 359 size_fig=get(handles.uvmat,'Position'); 363 ColumnWidth=max(150,0.18*size_fig(3)); 364 ColumnWidth=min(ColumnWidth,250); % width of the right side display column, between 150 and 250, depending on the fig width360 ColumnWidth=max(150,0.18*size_fig(3)); %width of the right side display column equal to 0.18 *uvmat_GUI, in the range between 150 px and 250 px 361 ColumnWidth=min(ColumnWidth,250); 365 362 366 363 %% position of panel InputFile 367 364 set(handles.InputFile,'Units','pixels') 368 pos_InputFile=get(handles.InputFile,'Position');% [lower x lower y width height] for text_display 369 pos_InputFile(1)=0; 370 pos_InputFile(2)=size_fig(4)-pos_InputFile(4); % set frame InputFile to the top of the fig 371 pos_InputFile(3)=size_fig(3); 372 set(handles.InputFile,'Position',pos_InputFile);% [lower x lower y width height] for text_display 365 %pos_InputFile=get(handles.InputFile,'Position')% [lower x lower y width height] for text_display 366 pos_InputFile(1)=0; % set frame InputFile to the left of uvmat GUI 367 pos_InputFile(2)=size_fig(4)-60; % set frame InputFile to the top of uvmat GUI 368 pos_InputFile(3)=size_fig(3); %width of the GUI uvmat 369 pos_InputFile(4)=60; %set the height of the panel to 60 px 370 set(handles.InputFile,'Position',pos_InputFile);% [lower x lower y width height] 373 371 374 372 %% reset position of text_display and TableDisplay … … 376 374 set(handles.TableDisplay,'Units','pixels') 377 375 pos_1=get(handles.text_display,'Position');% [lower x lower y width height] for text_display 378 pos_1(3)=1.2*ColumnWidth;376 pos_1(3)=1.2*ColumnWidth; 379 377 pos_1(1)=size_fig(3)-pos_1(3); % set text display to the right of the fig 380 378 pos_1(2)=size_fig(4)-pos_InputFile(4)-pos_1(4); % set text display to the top of the fig … … 396 394 %% reset position of Coordinates panel 397 395 set(handles.Coordinates,'Units','pixels') 398 pos_2=get(handles.Coordinates,'Position');% [lower x lower y width height] for frame 'Coordinates' 396 %pos_2=get(handles.Coordinates,'Position')% [lower x lower y width height] for frame 'Coordinates' 397 pos_2(1)=size_fig(3)-ColumnWidth; % set 'Coordinates' to the right of the fig 398 pos_2(2)=pos_1(2)-80; % set 'Coordinates' to the lower edge of text display 399 399 pos_2(3)=ColumnWidth; 400 pos_2(1)=size_fig(3)-pos_2(3); % set 'Coordinates' to the right of the fig 401 pos_2(2)=pos_1(2)-pos_2(4); % set 'Coordinates' to the lower edge of text display, allowing a margin for CheckHold 400 pos_2(4)=80;%keep height to 80 px 402 401 set(handles.Coordinates,'Position',pos_2) 403 402 404 403 %% reset position of Axes panel 405 404 set(handles.Axes,'Units','pixels') 406 pos_3=get(handles.Axes,'Position');% [lower x lower y width height] for frame 'Coordinates' 405 %pos_3=get(handles.Axes,'Position')% [lower x lower y width height] for frame 'Coordinates' 406 pos_3(1)=size_fig(3)-ColumnWidth; % set 'Coordinates' to the right of the fig 407 pos_3(2)=pos_2(2)-140; 407 408 pos_3(3)=ColumnWidth; 408 pos_3(1)=size_fig(3)-pos_3(3); % set 'Coordinates' to the right of the fig 409 pos_3(2)=pos_2(2)-pos_3(4); % set 'Coordinates' to the lower edge of text display, allowing a margin for CheckHold 409 pos_3(4)=140;%keep height to 140 px 410 410 set(handles.Axes,'Position',pos_3) 411 411 412 412 %% reset position of Scalar 413 413 set(handles.Scalar,'Units','pixels') 414 pos_4=get(handles.Scalar,'Position'); % [lower x lower y width height] for frame 'Scalar' 414 %pos_4=get(handles.Scalar,'Position') % [lower x lower y width height] for frame 'Scalar' 415 pos_4(1)=size_fig(3)-ColumnWidth; % set 'Scalar' to the right of the fig 416 if strcmp(get(handles.Scalar,'Visible'),'on') 417 pos_4(2)=pos_3(2)-140; % set 'Scalar' to the lower edge of frame 'Coordinates' if visible 418 else 419 pos_4(2)=pos_3(2);% set 'Scalar' to the lower edge of frame 'text display' if unvisible 420 end 415 421 pos_4(3)=ColumnWidth; 416 pos_4(1)=size_fig(3)-pos_4(3); % set 'Scalar' to the right of the fig 417 if strcmp(get(handles.Scalar,'Visible'),'on') 418 pos_4(2)=pos_3(2)-pos_4(4); % set 'Scalar' to the lower edge of frame 'Coordinates' if visible 419 else 420 pos_4(2)=pos_3(2);% set 'Scalar' to the lower edge of frame 'text display' if unvisible 421 end 422 pos_4(4)=140; 422 423 set(handles.Scalar,'Position',pos_4) 423 424 424 425 %% reset position of Vectors 425 426 set(handles.Vectors,'Units','pixels') 426 pos_5=get(handles.Vectors,'Position'); 427 %pos_5=get(handles.Vectors,'Position') 428 pos_5(1)=size_fig(3)-ColumnWidth; 429 if strcmp(get(handles.Vectors,'visible'),'on') 430 pos_5(2)=pos_4(2)-240; 431 else 432 pos_5(2)=pos_4(2); 433 end 427 434 pos_5(3)=ColumnWidth; 428 pos_5(1)=size_fig(3)-pos_5(3); 429 if strcmp(get(handles.Vectors,'visible'),'on') 430 pos_5(2)=pos_4(2)-pos_5(4); 431 else 432 pos_5(2)=pos_4(2); 433 end 435 pos_5(4)=240; 434 436 set(handles.Vectors,'Position',pos_5) 435 437 … … 459 461 % search the files, recognize their type according to their name and fill the rootfile input windows 460 462 function MenuBrowse_Callback(hObject, eventdata, handles) 463 % -------------------------------------------------------------------- 461 464 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 462 465 if isempty(regexp(RootPath,'^http://'))%usual files … … 484 487 % -------------------------------------------------------------------- 485 488 function MenuBrowseOpendap_Callback(hObject, eventdata, handles) 489 % -------------------------------------------------------------------- 486 490 oldfile=get(hObject,'Label'); 487 491 fileinput=uigetfile_uvmat('pick an input file',oldfile); … … 776 780 777 781 %% create movie 778 % duration = 2*FrameNumber/60;779 % [~,name,~] = fileparts(MovieName);780 % ffmpegcmd = ['ffmpeg -i ' ' ' MovieName ' ' '-filter:v "setpts=(',...781 % num2str(fps/duration),')*PTS"' ' ' strcat(MovieDir,...782 % strcat('/',name,'.mkv'))];783 % [ffmpeg_err,~] = system(ffmpegcmd);784 % if ffmpeg_err785 % disp_uvmat('ERROR',['ERROR: Errors in conversion to mkv, close MATLAB and run "LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab" in terminal'],1 )786 % return787 % end788 % msgbox_uvmat('CONFIRMATION',{['movie ' MovieName ' created '];['with ' num2str(FrameNumber) ' frames']})789 790 791 %792 782 aviobj = VideoWriter(MovieName,'Motion JPEG AVI'); 793 783 open(aviobj) … … 826 816 % -------------------------------------------------------------------- 827 817 function MenuExportCustom_Callback(hObject, eventdata, handles) 828 export_fct_name=get(handles.MenuExportCustom,'label'); 829 if strcmp( export_fct_name,'user export fct.')818 %------------------------------------------------------------------------ 819 if strcmp(get(handles.MenuExportCustom,'label'),'user export fct.') 830 820 MenuExportMore_Callback(hObject, eventdata, handles) 831 821 else 832 822 current_dir=pwd;%current working dir 833 823 cd(fullfile(fileparts(which('uvmat')),'export_fct')) 834 export_handle=str2func(export_fct_name); 835 cd(current_dir) 824 export_handle=str2func(export_fct_name);% pick the relevant export fct in the folder UVMAT/export_fct 825 cd(current_dir) %come back to the current working dir 836 826 export_handle(handles) 837 827 end … … 839 829 % -------------------------------------------------------------------- 840 830 function MenuExportMore_Callback(hObject, eventdata, handles) 841 831 %------------------------------------------------------------------------ 842 832 prev_path=fullfile(fileparts(which('uvmat')),'export_fct'); 843 833 transform_fct_chosen=uigetfile_uvmat('Pick the export function',prev_path,'.m'); 844 834 if ~isempty(transform_fct_chosen) 845 [ PathName,transform_name]=fileparts(transform_fct_chosen);835 [~,transform_name]=fileparts(transform_fct_chosen); 846 836 set(handles.MenuExportCustom,'label',transform_name) 847 set(handles.MenuExportCustom,'checked','on')848 837 MenuExportCustom_Callback(hObject, eventdata, handles) 849 838 end … … 953 942 data.ProjMode='interp_lin';%default 954 943 data.ProjModeMenu={}; 955 % set(handles.create,'Visible','on')956 % set(handles.create,'Value',1)957 % VOLUME_Callback(hObject,eventdata,handles)data.ProjModeMenu={};958 944 create_object(data,handles) 959 945 … … 2133 2119 function MenuHelp_Callback(hObject, eventdata, handles) 2134 2120 % -------------------------------------------------------------------- 2135 web('http ://servforge.legi.grenoble-inp.fr/projects/soft-uvmat/wiki/UvmatHelp')2121 web('https://gricad-gitlab.univ-grenoble-alpes.fr/legi/soft/uvmat-doc/-/blob/master/help/README.md') 2136 2122 2137 2123 … … 2923 2909 set(handles.RootFile,'String',RootFile) 2924 2910 else 2925 [ tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(index_string);% the index_string for the second series taken from FileIndex2911 [~,~,~,i1,i2,j1,j2]=fileparts_uvmat(index_string);% the index_string for the second series taken from FileIndex 2926 2912 switch index_rank 2927 2913 case 1 … … 4073 4059 else 4074 4060 if isempty(TimeUnit) 4075 set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' 10^(-3)'] )4061 set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' ms'] ) 4076 4062 else 4077 4063 set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' m' TimeUnit] ) … … 4709 4695 %----------------------------------------------------------------------- 4710 4696 % --- desactivate display used for a second file series 4697 function desable_subfield(handles) 4711 4698 %----------------------------------------------------------------------- 4712 function desable_subfield(handles)4713 4699 4714 4700 set(handles.RootPath_1,'String','') … … 4790 4776 NomType_1=get(handles.NomType,'String');%read FileExt by default 4791 4777 end 4778 4792 4779 %------------------------------------------------------------------------ 4793 4780 % --- Executes on menu selection FieldName 4794 4795 function FieldName_Callback(hObject, eventdata, handles) 4796 %------------------------------------------------------------------------ 4797 4781 function FieldName_Callback(hObject, eventdata, handles) 4782 %------------------------------------------------------------------------ 4798 4783 %% read data from uvmat 4799 4784 UvData=get(handles.uvmat,'UserData'); … … 4802 4787 field= list_fields{index_fields(1)}; % selected string 4803 4788 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 4804 if isempty(regexp(RootPath,'^http://' ))4789 if isempty(regexp(RootPath,'^http://', 'once')) 4805 4790 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 4806 4791 else 4807 4792 FileName=[RootPath '/' SubDir '/' RootFile FileIndices FileExt]; 4808 4793 end 4809 [ tild,tild,tild,i1,i2,j1,j2,tild,NomType]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt]);4794 [~,~,~,i1,~,j1,~,~,NomType]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt]); 4810 4795 4811 4796 switch field … … 4897 4882 set(handles.uvmat,'ToolBar','figure') 4898 4883 set(handles.Coord_y,'Max',2) 4899 %set(huvmat,4900 4884 case 'civdata...'%reinitiate input, return to automatic civ data readingget_field 4901 4885 UvData.FileInfo{1}.FieldType='netcdf'; … … 4924 4908 set(handles.MaxIndex_i,'String',MaxIndex_i)%TODO: record time unit 4925 4909 UvData.TimeUnit=GetFieldData.Time.TimeUnit; 4926 % % set(handles.uvmat,'UserData',UvData);4927 4910 set(handles.FileIndex,'String','') 4928 4911 ParamIn.TimeVarName=GetFieldData.Time.TimeName; … … 5005 4988 [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles); 5006 4989 FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1]; 5007 [ tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(get(handles.FileIndex,'String'));4990 [~,~,~,i1,~,j1,~]=fileparts_uvmat(get(handles.FileIndex,'String')); 5008 4991 switch field_1 5009 4992 case 'get_field...' … … 5106 5089 end 5107 5090 set(handles.Coord_x,'String',XName) 5108 % if ischar(YName)5109 % YName={YName};5110 % end5111 5091 set(handles.Coord_y,'String',YName) 5112 5092 set(handles.FieldName_1,'Value',1) … … 5370 5350 end 5371 5351 end 5372 if isfield(ObjectData,'Coord')& isfield(ObjectData,'Style')5352 if isfield(ObjectData,'Coord')&& isfield(ObjectData,'Style') 5373 5353 if isequal(ObjectData.Type,'polygon') 5374 5354 X=ObjectData.Coord(:,1); … … 5435 5415 5436 5416 %------------------------------------------------------------------------ 5417 5437 5418 %------------------------------------------------------------------------ 5438 5419 % --- Executes on selection change in TransformName. 5439 5440 5420 function TransformName_Callback(hObject, eventdata, handles) 5441 5421 %------------------------------------------------------------------------ … … 5512 5492 set(handles.TransformName,'ToolTipString','transform_fct:choose a transform function') 5513 5493 else 5514 try 5515 [fid,errormsg] =fopen([fullfile(list_path{ichoice},transform_name) '.m']); 5516 InputText=textscan(fid,'%s',1,'delimiter','\n'); 5517 fclose(fid); 5518 set(handles.TransformName,'ToolTipString',['transform_fct: ' InputText{1}{1}])% put the first line of the selected function as tooltip help 5519 end 5494 [fid,errormsg] =fopen([fullfile(list_path{ichoice},transform_name) '.m']); 5495 if ~isempty(errormsg) 5496 msgbox_uvmat('ERROR',errormsg) 5497 return 5498 end 5499 InputText=textscan(fid,'%s',1,'delimiter','\n'); 5500 fclose(fid); 5501 set(handles.TransformName,'ToolTipString',['transform_fct: ' InputText{1}{1}])% put the first line of the selected function as tooltip help 5520 5502 end 5521 5503 … … 5647 5629 %------------------------------------------------------------------------ 5648 5630 set(handles.CheckFixScalar,'Value',1) %suppress auto mode 5649 % set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])5650 5631 MinA=str2double(get(handles.num_MinA,'String')); 5651 5632 MaxA=str2double(get(handles.num_MaxA,'String')); … … 5699 5680 % Vector representation 5700 5681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5701 % % %-------------------------------------------------------------------5702 % % function CheckHideWarning_Callback(hObject, eventdata, handles)5703 % % %-------------------------------------------------------------------5704 % % update_plot(handles);5705 5682 5706 5683 %------------------------------------------------------------------- … … 5946 5923 end 5947 5924 PlotParam=read_GUI(handles.uvmat); 5948 [ tild,PlotParamOut]= plot_field(AxeData,handles.PlotAxes,PlotParam);5925 [~,PlotParamOut]= plot_field(AxeData,handles.PlotAxes,PlotParam); 5949 5926 errormsg=fill_GUI(PlotParamOut,handles.uvmat); 5950 5927 if isempty(errormsg) … … 6006 5983 % desactivate the edit object mode 6007 5984 set(handles.CheckEditObject,'Value',0) 6008 % set(handles.CheckEditObject,'BackgroundColor',[0.7,0.7,0.7])6009 5985 6010 5986 %------------------------------------------------------------------------ … … 6144 6120 end 6145 6121 6146 6147 6122 %------------------------------------------------------------------------ 6148 6123 % --- Executes on button press in CheckViewObject. … … 6151 6126 check_view=get(handles.CheckViewObject,'Value'); 6152 6127 hset_object=findobj(allchild(0),'tag','set_object'); 6153 % if ~isempty(hset_object)6154 % delete(hset_object)% delete existing version of set_object6155 % end6156 6128 if check_view %activate set_object 6157 6129 IndexObj=get(handles.ListObject,'Value'); … … 6194 6166 end 6195 6167 6196 6197 6168 %------------------------------------------------------------------------ 6198 6169 % --- Executes on button press in CheckViewField. … … 6231 6202 end 6232 6203 hhview_field=guidata(hview_field); 6233 [ PlotType,PlotParam]=plot_field(ProjData,hhview_field.PlotAxes,read_GUI(hview_field));%read plotting parameters on the GUI view_field);6204 [~,PlotParam]=plot_field(ProjData,hhview_field.PlotAxes,read_GUI(hview_field));%read plotting parameters on the GUI view_field); 6234 6205 errormsg=fill_GUI(PlotParam,hview_field); 6235 6206 for list={'Scalar','Vectors'} … … 6254 6225 end 6255 6226 6256 6257 6227 %------------------------------------------------------------------------ 6258 6228 % --- Executes on button press in DeleteObject. 6259 %------------------------------------------------------------------------6260 6229 function DeleteObject_Callback(hObject, eventdata, handles) 6261 6230 %------------------------------------------------------------------------ 6262 6231 IndexObj=get(handles.ListObject,'Value');%projection object selected for view_field 6263 6232 IndexObj_1=get(handles.ListObject_1,'Value');%projection object selected for uvmat plot … … 6266 6235 end 6267 6236 6268 %'DeleteObject': delete a projection object, defined by its index in the Uvmat list or by its graphic handle 6269 %------------------------------------------------------------------------ 6270 % function DeleteObject(hObject) 6271 % 6272 % INPUT: 6273 % hObject: object index (if integer) or handle of the graphic object. If 6274 % hObject is a subobject, the parent object is detected and deleted. 6275 6237 % -------------------------------------------------------------------- 6238 % --- Delete a projection object, defined by its index in the Uvmat list or by its graphic handle 6276 6239 function delete_object(IndexObj) 6277 6240 %------------------------------------------------------------------------ 6278 6241 huvmat=findobj('tag','uvmat');%handles of the uvmat interface 6279 6242 UvData=get(huvmat,'UserData'); … … 6333 6296 end 6334 6297 6335 6336 6337 6338 6298 % -------------------------------------------------------------------- 6339 6299 % --- Executes on selection change in LogLinHisto. 6300 % -------------------------------------------------------------------- 6340 6301 function LogLinHisto_Callback(hObject, eventdata, handles) 6341 HistoMenu_Callback(hObject, eventdata, handles) 6342 % hObject handle to LogLinHisto (see GCBO) 6343 % eventdata reserved - to be defined in a future version of MATLAB 6344 % handles structure with handles and user data (see GUIDATA) 6345 6346 % Hints: contents = cellstr(get(hObject,'String')) returns LogLinHisto contents as cell array 6347 % contents{get(hObject,'Value')} returns selected item from LogLinHisto 6302 HistoMenu_Callback(hObject, eventdata, handles)
Note: See TracChangeset
for help on using the changeset viewer.
