Changeset 45 for trunk/src/uvmat.m
- Timestamp:
- Mar 15, 2010, 5:39:44 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r42 r45 5 5 %OUTPUT 6 6 % huvmat=current handles of the GUI uvmat.fig 7 %% 7 8 % 8 9 %INPUT: … … 80 81 % Main input open second input open(_1) second image (pair animation) 81 82 % read_ncfield.m | | 82 % read _image.m | |83 % read image.m | | 83 84 % Field{1} Field{2} 84 85 % | … … 225 226 menu_str={'';'phys';'px';'phys_polar'}; 226 227 nb_builtin=numel(menu_str); %number of functions 227 [path_uvmat,name,ext]=fileparts(which('uvmat'));228 path_uvmat=fileparts(which('uvmat')); 228 229 addpath(fullfile(path_uvmat,'transform_field')) 229 230 fct_handle{1,1}=[]; 231 testexist=zeros(size(menu_str));%default 230 232 testexist(1)=1; 231 233 for ilist=2:length(menu_str) … … 270 272 if exist(file,'file') 271 273 h_func=str2func(file); 272 testexist=[testexist 1]; 274 testexist=[testexist 1]; %#ok<AGROW> 273 275 else 274 276 h_func=[]; 275 testexist=[testexist 0]; 277 testexist=[testexist 0]; %#ok<AGROW> 276 278 end 277 fct_handle=[fct_handle; {h_func}];% concatene the list of paths279 fct_handle=[fct_handle; {h_func}];%#ok<AGROW> %concatene the list of paths 278 280 rmpath(path) 279 menu_str=[menu_str; {file}]; 281 menu_str=[menu_str; {file}]; %#ok<AGROW> 280 282 end 281 283 end 282 284 end 283 menu_str=menu_str( find(testexist));284 fct_handle=fct_handle( find(testexist));285 menu_str=menu_str(testexist==1);%=menu_str(testexist~=0) 286 fct_handle=fct_handle(testexist==1); 285 287 menu_str=[menu_str;{'more...'}]; 286 288 set(handles.transform_fct,'String',menu_str) … … 295 297 path_to_uvmat=which ('uvmat');% check the path detected for source file uvmat 296 298 [errormsg,date_str]=check_functions;%check the path of the functions called by uvmat.m 297 299 date_str=['last modification: ' date_str]; 298 300 %case of an input argument for uvmat 299 301 testinputfield=0; … … 346 348 if fid~=-1 347 349 a=textscan(fid,'%s%s%s',1,'HeaderLines',1,'Delimiter','|'); 348 set(handles.UVMAT_title,'String',[{'Copyright Joel Sommeria, 2008, Coriolis/ LEGI / CNRS-UJF-INPG';'GNU General Public License'; path_to_uvmat; ['at revision ' a{1}{1}]};a{3}{1}; errormsg]);350 set(handles.UVMAT_title,'String',[{'Copyright Joel Sommeria, 2008, Coriolis/ LEGI / CNRS-UJF-INPG';'GNU General Public License'; path_to_uvmat; ['at revision ' a{1}{1}]};a{3}{1};date_str;errormsg]); 349 351 fclose(fid); 350 352 else … … 819 821 set(handles.Fields,'Value',1) % set menu to 'image' 820 822 set(handles.Fields,'String',{'image';'get_field...';'velocity';'vort';'div';'more...'}) 821 elseif isequal(FileExt,'.nc')| isequal(FileExt,'.cdf')823 elseif isequal(FileExt,'.nc')||isequal(FileExt,'.cdf') 822 824 Data=nc2struct(FileName,[]); 823 825 col_vec=get(handles.col_vec,'String'); 824 if isfield(Data,'absolut_time_T0') && (isfield(Data,'civ1')||isfield(Data,'civ'))826 if isfield(Data,'absolut_time_T0')%&& (isfield(Data,'civ1')||isfield(Data,'civ')) 825 827 set(handles.Fields,'String',{'image';'get_field...';'velocity';'vort';'div';'more...'}) 826 828 set(handles.Fields,'Value',3) % set menu to 'velocity' 827 829 col_vec{1}='ima_cor'; 828 else 830 else %general netcdf file (not civx) 829 831 set(handles.Fields,'Value',1) % set menu to 'get_field... 830 832 set(handles.Fields,'String',{'get_field...'}) … … 1270 1272 set_scan_options(hObject, eventdata, handles) 1271 1273 1272 1273 1274 %--------------------------------------------------- 1274 1275 % switch file index scanning options scan_i and scan_j in an exclusive way … … 1284 1285 set(handles.scan_j,'BackgroundColor',[1 1 0]) 1285 1286 end 1286 %------------------------------------------------------------------- 1287 %--------------------------------------------------- 1287 1288 %------------------------------------------------------------------- 1288 1289 % switch file index scanning options scan_i and scan_j in an exclusive way 1289 1290 function scan_j_Callback(hObject, eventdata, handles) 1290 %---------------------------------------------------1291 1291 %------------------------------------------------------------------- 1292 1292 if get(handles.scan_j,'Value')==1 … … 1304 1304 %------------------------------------------------------------------- 1305 1305 % [filebase,num1,num_a,num2,num_b,ext,NomType,subdir]=read_input_file(handles); 1306 [FileName,RootPath,filebase,xx,FileExt]=read_file_boxes(handles);1306 %[FileName,RootPath,filebase,xx,FileExt]=read_file_boxes(handles); 1307 1307 NomType=get(handles.FileIndex,'UserData'); 1308 1308 num1=stra2num(get(handles.i1,'String')); … … 1690 1690 index_fields=get(handles.Fields,'Value');% selected string index 1691 1691 FieldName=list_fields{index_fields}; % selected field 1692 huvmat=get(handles.movie_pair,'parent');1692 %huvmat=get(handles.movie_pair,'parent'); 1693 1693 if isequal(FieldName,'image') 1694 1694 run0_Callback(hObject, eventdata, handles)%display the first image 1695 UvData=get(h uvmat,'UserData');1695 UvData=get(handles.uvmat,'UserData'); 1696 1696 else 1697 1697 msgbox_uvmat('ERROR','an image or movie must be first introduced as input') … … 1727 1727 Field.AY=UvData.Field.AY; 1728 1728 Field.CoordType='px'; 1729 [Field.A,error]=read_image(imaname_1,NomType,num_i2); 1730 1729 %determine the input file type 1730 if isfield(UvData,'MovieObject') 1731 FileType='movie'; 1732 elseif isequal(lower(Ext),'.avi') 1733 FileType='avi'; 1734 elseif isequal(lower(Ext),'.vol') 1735 FileType='vol'; 1736 else 1737 form=imformats(Ext([2:end])); 1738 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 1739 if isequal(NomType,'*'); 1740 FileType='multimage'; 1741 else 1742 FileType='image'; 1743 end 1744 end 1745 end 1746 switch FileType 1747 case 'movie' 1748 Field.A=read(UvData.MovieObject,num_i2); 1749 case 'avi' 1750 mov=aviread(imaname_1,num_i2); 1751 Field.A=frame2im(mov(1)); 1752 case 'vol' 1753 Field.A=imread(imaname_1); 1754 case 'multimage' 1755 Field.A=imread(imaname_1,num_i2); 1756 case 'image' 1757 Field.A=imread(imaname_1); 1758 end 1731 1759 1732 1760 %px to phys or other transform on field … … 1747 1775 set(handles.speed,'Visible','on') 1748 1776 set(handles.speed_txt,'Visible','on') 1749 while get(handles.speed,'Value')~=0 & isequal(get(handles.run0,'BusyAction'),'queue'); % enable STOP command1777 while get(handles.speed,'Value')~=0 && isequal(get(handles.run0,'BusyAction'),'queue'); % enable STOP command 1750 1778 % read and plot the series of images in non erase mode 1751 1779 set(hima,'CData',Field.A); … … 1755 1783 end 1756 1784 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 1757 1758 %run0_Callback(hObject, eventdata, handles)1759 1785 1760 1786 %------------------------------------------------------- … … 1769 1795 abstime_1=[]; 1770 1796 dt=[]; 1771 CalibCell={};%default1797 % CalibCell={};%default 1772 1798 Field={}; 1773 huvmat=get(handles.run0,'parent');1774 UvData=get(h uvmat,'UserData');1799 %huvmat=get(handles.run0,'parent'); 1800 UvData=get(handles.uvmat,'UserData'); 1775 1801 if isfield(UvData,'Txt') 1776 1802 UvData=rmfield(UvData,'Txt');%erase previous error message … … 1787 1813 end 1788 1814 num_i1=[];%default 1815 FileType=[];%default 1789 1816 if TestInputFile 1790 [filename,RootPath,filebase,xx,Ext ,SubDir]=read_file_boxes(handles);1817 [filename,RootPath,filebase,xx,Ext]=read_file_boxes(handles); 1791 1818 if ~exist(filename,'file') 1792 1819 msgbox_uvmat('ERROR',['input file ' filename ' does not exist']) … … 1802 1829 % set(handles.z_index,'String',get(handles.j1,'String')); 1803 1830 % else 1804 nbslice=str2 num(get(handles.nb_slice,'String'));1805 z_index=mod(num_i1-1,nbslice)+1;1831 nbslice=str2double(get(handles.nb_slice,'String')); 1832 % z_index=mod(num_i1-1,nbslice)+1; 1806 1833 if ~isempty(nbslice) 1807 1834 z_index=mod(num_i1-1,nbslice)+1; … … 1813 1840 end 1814 1841 end 1815 % end 1816 % choose the main field 1817 testima=0; 1818 if isequal(lower(Ext),'.avi')||isequal(lower(Ext),'.vol') 1819 testima=1; 1820 FieldName='image'; 1842 % determine the input file type 1843 if isequal(Ext,'.nc')||isequal(Ext,'.cdf') 1844 FileType='netcdf'; 1845 elseif isfield(UvData,'MovieObject') 1846 FileType='movie'; 1847 FieldName='image'; 1848 elseif isequal(lower(Ext),'.avi') 1849 FileType='avi'; 1850 FieldName='image'; 1851 elseif isequal(lower(Ext),'.vol') 1852 FileType='vol'; 1853 FieldName='image'; 1821 1854 else 1822 1855 form=imformats(Ext([2:end])); 1823 1856 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 1824 testima=1; 1857 if isequal(NomType,'*'); 1858 FileType='multimage'; 1859 else 1860 FileType='image'; 1861 end 1825 1862 FieldName='image'; 1826 1863 end … … 1828 1865 else 1829 1866 filename=[]; 1867 FileType='netcdf'; 1830 1868 FieldName='get_field...'; 1831 testima=0;1832 1869 end 1833 1870 VelType=[];%default 1834 1835 if ~testima 1871 if isequal(FileType,'netcdf') 1836 1872 list_fields=get(handles.Fields,'String');% list menu fields 1837 1873 index_fields=get(handles.Fields,'Value');% selected string index … … 1842 1878 else 1843 1879 VelType=setfield(handles); 1844 %enable_transform(handles,'on')% no field transform (possible transform in the GUI get_field)1845 1880 end 1846 1881 end … … 1848 1883 % choose a second field if Subfield option is 'on' 1849 1884 filename_1=[]; 1850 VelType_1=[];%default1851 1885 FieldName_1=[]; 1852 1886 scal_color=[]; 1853 testvel=0;1854 testX=0;%default1887 % testvel=0; 1888 % testX=0;%default 1855 1889 VelType_1=setfield_1(handles); 1856 1890 sub_value=get(handles.SubField,'Value'); 1891 FileType_1='none';%default 1857 1892 if sub_value==1 1858 1893 filename_1=read_file_boxes_1(handles); … … 1862 1897 end 1863 1898 NomType_1=get(handles.FileIndex_1,'UserData'); 1864 list_fields=get(handles.Fields_1,'String');% list menu fields 1865 index_fields=get(handles.Fields_1,'Value');% selected string index 1866 FieldName_1= list_fields{index_fields}; % selected field 1867 if isequal(VelType_1,'*')% free veltype choice 1868 VelType_1=[]; 1869 elseif isequal(VelType_1,'"')% veltype the same as for the first field 1870 if isempty(VelType) 1899 Ext_1=get(handles.FileExt_1,'String'); 1900 % determine the input file type 1901 if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf') 1902 FileType_1='netcdf'; 1903 elseif isfield(UvData,'MovieObject_1') 1904 FileType_1='movie'; 1905 FieldName_1='image'; 1906 elseif isequal(lower(Ext_1),'.avi') 1907 FileType='avi'; 1908 FieldName_1='image'; 1909 elseif isequal(lower(Ext_1),'.vol') 1910 FileType_1='vol'; 1911 FieldName_1='image'; 1912 else 1913 form=imformats(Ext([2:end])); 1914 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 1915 if isequal(NomType_1,'*'); 1916 FileType_1='multimage'; 1917 else 1918 FileType_1='image'; 1919 end 1920 FieldName_1='image'; 1921 end 1922 end 1923 if ~isequal(FieldName_1,'image') 1924 list_fields=get(handles.Fields_1,'String');% list menu fields 1925 index_fields=get(handles.Fields_1,'Value');% selected string index 1926 FieldName_1= list_fields{index_fields}; % selected field 1927 if isequal(VelType_1,'*')% free veltype choice 1871 1928 VelType_1=[]; 1872 else 1873 VelType_1=VelType; 1929 elseif isequal(VelType_1,'"')% veltype the same as for the first field 1930 if isempty(VelType) 1931 VelType_1=[]; 1932 else 1933 VelType_1=VelType; 1934 end 1874 1935 end 1875 1936 end … … 1881 1942 if sub_value>=2 1882 1943 if ~isequal(NomType_1,'*')%in cas of a series of files (not avi movie) 1883 if isfield(UvData,'filename_1')& isfield(UvData,'VelType_1')& isfield(UvData,'FieldName_1')1884 test_keepdata_1= isequal(filename_1,UvData.filename_1)& ...1885 isequal(VelType_1,UvData.filename_1) & isequal(FieldName_1,UvData.FieldName_1);1944 if isfield(UvData,'filename_1')&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1') 1945 test_keepdata_1= isequal(filename_1,UvData.filename_1)&&... 1946 isequal(VelType_1,UvData.filename_1) && isequal(FieldName_1,UvData.FieldName_1); 1886 1947 1887 1948 end … … 1890 1951 1891 1952 %read the input field(s) 1892 testima_1=isequal(FieldName_1,'image'); 1953 % testima_1=isequal(FieldName_1,'image'); 1954 1893 1955 %read images 1894 if ~isempty(filename) && testima 1895 if isfield(UvData,'MovieObject') 1896 A=read(UvData.MovieObject,num_i1); 1897 else 1898 [A,error]=read_image(filename,NomType,num_i1); 1899 if ~isequal(error,0) 1900 msgbox_uvmat('ERROR',error) 1901 return 1902 end 1956 if ~isempty(filename) && isequal(FieldName,'image') 1957 switch FileType 1958 case 'movie' 1959 A=read(UvData.MovieObject,num_i1); 1960 case 'avi' 1961 mov=aviread(filename,num_i1); 1962 A=frame2im(mov(1)); 1963 case 'vol' 1964 A=imread(filename); 1965 case 'multimage' 1966 A=imread(filename,num_i1); 1967 case 'image' 1968 A=imread(filename); 1903 1969 end 1904 1970 npxy=size(A); … … 1907 1973 Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers 1908 1974 Rangy=[npxy(1)-0.5 0.5]; % 1909 npx=str2num(get(handles.npx,'String'));1910 npy=str2num(get(handles.npy,'String'));1911 if isfield(UvData.XmlData,'Time')1912 abs_time=UvData.XmlData.Time;1913 end1914 1975 Field{1}.AName='image'; 1915 1976 Field{1}.ListVarName={'AY','AX','A'}; % … … 1925 1986 Field{1}.CoordUnit='pixel'; %used for mouse_motion 1926 1987 end 1927 if ~isfield(UvData,'Txt')& ~isempty(filename_1) & testima_1 1928 [A,error]=read_image(filename_1,NomType_1,num_i1); 1929 if ~isequal(error,0) 1930 msgbox_uvmat('ERROR',error) 1931 return 1932 end 1988 if ~isfield(UvData,'Txt')&& ~isempty(filename_1) && isequal(FieldName_1,'image') 1989 switch FileType_1 1990 case 'movie' 1991 A=read(UvData.MovieObject_1,num_i1); 1992 case 'avi' 1993 mov=aviread(filename,num_i1); 1994 A=frame2im(mov(1)); 1995 case 'vol' 1996 A=imread(filename); 1997 case 'multimage' 1998 A=imread(filename,num_i1); 1999 case 'image' 2000 A=imread(filename); 2001 end 1933 2002 npxy=size(A); 1934 2003 set(handles.npx,'String',num2str(npxy(2)));% display image size on the interface … … 1936 2005 Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers 1937 2006 Rangy=[npxy(1)-0.5 0.5]; % 1938 npx=str2num(get(handles.npx,'String'));1939 npy=str2num(get(handles.npy,'String'));1940 if isfield(UvData,'XmlData_1') && isfield(UvData.XmlData_1,'Time')1941 abs_time=UvData.XmlData_1.Time;1942 end2007 % npx=str2num(get(handles.npx,'String')); 2008 % npy=str2num(get(handles.npy,'String')); 2009 % if isfield(UvData,'XmlData_1') && isfield(UvData.XmlData_1,'Time') 2010 % abs_time=UvData.XmlData_1.Time; 2011 % end 1943 2012 Field{2}.AName='image'; 1944 2013 Field{2}.ListVarName={'AY','AX','A'}; % … … 1960 2029 InputField={FieldName}; 1961 2030 InputField_1={FieldName_1}; 1962 if ~isfield(UvData,'Txt') && ((~isempty(filename)& ~testima) || (~isempty(filename_1)&~testima_1)) ;2031 if ~isfield(UvData,'Txt') && ((~isempty(filename)&& isequal(FileType,'netcdf')) || (~isempty(filename_1)&& isequal(FileType,'netcdf'))) ; 1963 2032 %read the velocity field(s) from netcdf rootfile(s) 1964 2033 list_code=get(handles.col_vec,'String');% list menu fields … … 1971 2040 InputField_1=[InputField_1 scal_color]; 1972 2041 end 1973 if ~testima%read the first nc field2042 if isequal(FileType,'netcdf') %read the first nc field 1974 2043 if isequal(FieldName,'get_field...')% read the field names on the interface get_field. 1975 test_detect=0;%default2044 % test_detect=0;%default 1976 2045 VelType=get(handles.Fields,'UserData'); 1977 2046 hget_field=findobj(allchild(0),'Name','get_field');%find the get_field... GUI … … 1979 2048 hget_field= get_field(filename);%open the get_field GUI 1980 2049 end 1981 test_detect=1;2050 % test_detect=1; 1982 2051 hhget_field=guidata(hget_field); 1983 2052 set(hhget_field.inputfile,'String',filename)% update the list of input fields in get_field … … 2001 2070 end 2002 2071 end 2003 if ~isempty(filename_1) && ~testima_1%read the second file2072 if ~isempty(filename_1) && isequal(FileType_1,'netcdf') %read the second file 2004 2073 if isequal(FieldName_1,'get_field...')% read the field names on the interface get_field. 2005 test_detect=0;%default2074 % test_detect=0;%default 2006 2075 hget_field=findobj(allchild(0),'Name','get_field_1');%find the get_field... GUI 2007 2076 if isempty(hget_field) … … 2010 2079 % enable_transform(handles,'off')% no field transform (possible transform in the GUI get_field) 2011 2080 end 2012 test_detect=1;2081 % test_detect=1; 2013 2082 hhget_field=guidata(hget_field);%handles of GUI elements in get_field 2014 2083 SubField=get_field('read_var_names',hObject,eventdata,hhget_field); %read the names of the variables to plot in the get_field GUI … … 2023 2092 % end 2024 2093 % end 2025 2026 2094 %update the display on get_field 2027 2095 set(hhget_field.inputfile,'String',filename_1) … … 2051 2119 CivStage_1=Field{2}.CivStage; 2052 2120 end 2053 if testima2121 if ~isequal(FileType,'netcdf') 2054 2122 VelType_out=VelType_out_1; 2055 2123 end … … 2059 2127 %update the display buttons for the first velocity type (first menuline) 2060 2128 veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2]; 2061 if testima2129 if ~isequal(FileType,'netcdf') 2062 2130 reset_vel_type(veltype_handles) 2063 2131 elseif isempty(VelType) … … 2073 2141 %update the display buttons for the second velocity type (second menuline) 2074 2142 veltype_handles_1=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1]; 2075 if testima_12143 if ~isequal(FileType_1,'netcdf') 2076 2144 reset_vel_type(veltype_handles_1) 2077 2145 elseif isempty(VelType_1) … … 2090 2158 end 2091 2159 %put W as background image by default if NbDim=2: 2092 if ~isfield(UvData,'NbDim')| isempty(UvData.NbDim)|~isequal(UvData.NbDim,3)2160 if ~isfield(UvData,'NbDim')||isempty(UvData.NbDim)||~isequal(UvData.NbDim,3) 2093 2161 if UvData.NewSeries && isequal(get(handles.SubField,'Value'),0) && isfield(Field{1},'W') && ~isempty(Field{1}.W); 2094 2162 set(handles.SubField,'Value',1); 2095 menu=update_menu(handles.Fields_1,'w');%update the menu for the background scalar nd set the choice to 'w'2163 %menu=update_menu(handles.Fields_1,'w');%update the menu for the background scalar nd set the choice to 'w' 2096 2164 set(handles.RootPath_1,'String','"') 2097 2165 set(handles.RootFile_1,'String','"') … … 2176 2244 2177 2245 %calculate scalar 2178 if ~testima&& ~isequal(FieldName,'get_field...')%2246 if isequal(FileType,'netcdf') && ~isequal(FieldName,'get_field...')% 2179 2247 Field{1}=calc_field(InputField,Field{1}); 2180 2248 end 2181 if length(Field)==2 && ~testima_1 && ~isequal(FieldName,'get_field...')2249 if length(Field)==2 && isequal(FileType_1,'netcdf') && ~isequal(FieldName_1,'get_field...') 2182 2250 Field{2}=calc_field(InputField_1,Field{2}); 2183 2251 end … … 2185 2253 % combine the two input fields (e.g. substract velocity fields) 2186 2254 if numel(Field)==2 2187 if ~(isequal(get(handles.movie_pair,'Value'),1) & isequal(FieldName,'image')& isequal(FieldName_1,'image')) %combine fields if not viewing image pairs2255 if ~(isequal(get(handles.movie_pair,'Value'),1) && isequal(FieldName,'image') && isequal(FieldName_1,'image')) %combine fields if not viewing image pairs 2188 2256 UvData.Field=sub_field(Field{1},Field{2}); %TO UPDATE FOR MORE GENERAL INPUT 2189 2257 end … … 2206 2274 [NbDim,imax]=max(NbDim); 2207 2275 if isempty(imax) 2208 DimVarIndex=0;2276 % DimVarIndex=0; 2209 2277 coord_x=[]; 2210 2278 else 2211 VarIndex=CellVarIndex{imax};2279 % VarIndex=CellVarIndex{imax}; 2212 2280 coord_x=VarType{imax}.coord_x; 2213 2281 end 2214 if isfield(UvData,'NbDim') & ~isempty(UvData.NbDim)2282 if isfield(UvData,'NbDim') && ~isempty(UvData.NbDim) 2215 2283 NbDim=UvData.NbDim; 2216 2284 else 2217 2285 UvData.NbDim=NbDim; 2218 2286 end 2219 if ~isempty(CellVarIndex) & ~isempty(VarType{imax}.coord_x)& ~isempty(VarType{imax}.coord_y) %unstructured coordinate z2287 if ~isempty(CellVarIndex) && ~isempty(VarType{imax}.coord_x) && ~isempty(VarType{imax}.coord_y) %unstructured coordinate z 2220 2288 XName=UvData.Field.ListVarName{VarType{imax}.coord_x}; 2221 2289 YName=UvData.Field.ListVarName{VarType{imax}.coord_y}; 2222 2290 test_x=1; 2223 elseif isfield(UvData.Field,'X') &isfield(UvData.Field,'Y')2291 elseif isfield(UvData.Field,'X') && isfield(UvData.Field,'Y') 2224 2292 XName='X'; 2225 2293 YName='Y'; … … 2233 2301 eval(['nbvec=length(UvData.Field.' XName ');']) 2234 2302 if NbDim==3% 2235 if ~isempty(CellVarIndex) & ~isempty(VarType{imax}.coord_z)%unstructured coordinate z2303 if ~isempty(CellVarIndex) && ~isempty(VarType{imax}.coord_z)%unstructured coordinate z 2236 2304 ZName=UvData.Field.ListVarName{VarType{imax}.coord_z}; 2237 2305 eval(['UvData.ZMax=max(UvData.Field.' ZName ');']) … … 2456 2524 %display the updated plotting parameters for the base menuplane 2457 2525 write_plot_param(handles,UvData.Object{1}.PlotParam);% update the display of the plotting parameters 2458 set(h uvmat,'UserData',UvData)2526 set(handles.uvmat,'UserData',UvData) 2459 2527 2460 2528 %update the mask … … 2606 2674 %------------------------------------------------------------------- 2607 2675 function zoom_Callback(hObject, eventdata, handles) 2608 huvmat=get(handles.zoom,'parent');%general input2609 UvData=get(h uvmat,'UserData');2676 %huvmat=get(handles.zoom,'parent');%general input 2677 UvData=get(handles.uvmat,'UserData'); 2610 2678 if (get(handles.zoom,'Value') == 1); 2611 2679 set(handles.zoom,'BackgroundColor',[1 1 0]) … … 2617 2685 %UvData.ZoomOn=0; %test for mouse action 2618 2686 end 2619 set(h uvmat,'UserData',UvData);2687 set(handles.uvmat,'UserData',UvData); 2620 2688 2621 2689 %------------------------------------------------------------------- … … 2845 2913 if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2')|| isequal(NomType,'#_ab')|| isequal(NomType,'_i1-i2') 2846 2914 UvData.SubDir=get(handles.SubDir,'String'); %preserve the subdir in memory 2847 if ~isempty(UvData.SubDir) && (isequal(UvData.SubDir(1),'/')| isequal(UvData.SubDir(1),'/'))2915 if ~isempty(UvData.SubDir) && (isequal(UvData.SubDir(1),'/')||isequal(UvData.SubDir(1),'/')) 2848 2916 UvData.SubDir(1)=[]; 2849 2917 end 2850 2918 set(handles.SubDir,'String','') 2851 2919 set(handles.FileExt,'String','.png'); 2852 if isequal(NomType,'_i1-i2_j')| isequal(NomType,'_i_j1-j2')2920 if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2') 2853 2921 NomTypeNew='_i_j'; 2854 2922 elseif isequal(NomType,'#_ab') … … 2874 2942 set(handles.civ2,'BackgroundColor',[0.702 0.702 0.702]) 2875 2943 str=calc_field;%get the list of available scalars by the function calc_scal 2876 [ind_answer ,v] = listdlg('PromptString','Select a file:',...2944 [ind_answer] = listdlg('PromptString','Select a file:',... 2877 2945 'SelectionMode','single',... 2878 2946 'ListString',str); … … 2884 2952 end 2885 2953 end 2886 indices=name_generator('',str2 num(str1),str2num(str_a),'',NomTypeNew,1,str2num(str2),str2num(str_b),'');2954 indices=name_generator('',str2double(str1),str2double(str_a),'',NomTypeNew,1,str2double(str2),str2double(str_b),''); 2887 2955 set(handles.FileIndex,'String',indices) 2888 2956 set(handles.FileIndex,'UserData',NomTypeNew) 2889 2957 %common to Fields_1_Callback 2890 if isequal(field,'image')| isequal(field_1,'image')2958 if isequal(field,'image')||isequal(field_1,'image') 2891 2959 set(handles.npx_title,'Visible','on')% visible npx,pxcm... buttons 2892 2960 set(handles.npy_title,'Visible','on') … … 2901 2969 set(handles.fix_pair,'Value',1) 2902 2970 end 2903 if isequal(field,'velocity')|isequal(field_1,'velocity');2904 state_vect='on';2905 else2906 state_vect='off';2907 end2908 if ~isequal(field,'velocity')|(~isequal(field_1,'velocity'));2909 state_scal='on';2910 else2911 state_scal='off';2912 end2971 % if isequal(field,'velocity')|isequal(field_1,'velocity'); 2972 % state_vect='on'; 2973 % else 2974 % state_vect='off'; 2975 % end 2976 % if ~isequal(field,'velocity')|(~isequal(field_1,'velocity')); 2977 % state_scal='on'; 2978 % else 2979 % state_scal='off'; 2980 % end 2913 2981 setfield(handles);% update the field structure ('civ1'....) 2914 2982 2915 if ~isfield(UvData,'NewSeries')| isequal(UvData.NewSeries,0)2983 if ~isfield(UvData,'NewSeries')||isequal(UvData.NewSeries,0) 2916 2984 run0_Callback(hObject, eventdata, handles) 2917 2985 end … … 4751 4819 4752 4820 [FileName,RootPath,filebase,FileIndices,ext,SubDir]=read_file_boxes(handles); 4753 [P,F,str1,str2,str_a,str_b]=name2display(FileName); 4754 num1=stra2num(str1); 4755 num2=stra2num(str2); 4756 num_a=stra2num(str_a); 4757 num_b=stra2num(str_b); 4821 num1=stra2num(get(handles.i1,'String')); 4822 num2=stra2num(get(handles.i2,'String')); 4823 num_a=stra2num(get(handles.j1,'String')); 4824 num_b=stra2num(get(handles.j2,'String')); 4758 4825 NomType=get(handles.FileIndex,'UserData'); 4759 4826 ind_opening=1; % default (images): will advice civ1 option by default in the civ interface … … 4840 4907 % ------------------------------------------------------------------ 4841 4908 function Menupolygon_Callback(hObject, eventdata, handles) 4842 set(handles.create,'Visible','on') 4843 set(handles.create,'Value',1) 4844 PATCH_Callback(hObject,eventdata,handles) 4909 % set(handles.create,'Visible','on') 4910 % set(handles.create,'Value',1) 4911 % PATCH_Callback(hObject,eventdata,handles) 4912 data.Style='polygon'; 4913 data.ProjMode='inside';%default 4914 PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters 4915 create_object(data,handles.uvmat,PlotHandles) 4845 4916 4846 4917 %------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.