- Timestamp:
- Mar 15, 2010, 5:42:11 PM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mouse_down.m
r40 r46 203 203 set(huvmat,'UserData',UvData) 204 204 list_str=get(hhuvmat.list_object,'String'); 205 list_str{IndexObj}=[num2str(IndexObj) '-' set_title(ObjectData.Style,ObjectData.ProjMode)];205 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style]; 206 206 if ~isequal(list_str{end},'...') 207 207 list_str{end+1}='...'; -
trunk/src/plot_field.m
r42 r46 137 137 hfig=figure; 138 138 if isfield(Data,'IndexObj')&isfield(Data,'Style')&isfield(Data,'ProjMode') 139 figname=[num2str(Data.IndexObj) '-' set_title(Data.Style,Data.ProjMode)];139 figname=[num2str(Data.IndexObj) '-' Data.Style]; 140 140 set(hfig,'Name',figname) 141 141 end … … 1016 1016 test_lim=0; 1017 1017 if test_vec 1018 'TESTplot' 1019 Xlim=[min(vec_X) max(vec_X)] 1020 Ylim=[min(vec_Y) max(vec_Y)] 1018 Xlim=[min(vec_X) max(vec_X)]; 1019 Ylim=[min(vec_Y) max(vec_Y)]; 1021 1020 test_lim=1; 1022 1021 if test_ima%both background image and vectors coexist, take the wider bound … … 1033 1032 test_lim=1; 1034 1033 end 1035 if test_lim 1036 set(haxes,'XLim',Xlim);% set x limits of frame in axes coordinates 1037 set(haxes,'YLim',Ylim);% set y limits of frame in axes coordinate 1034 if test_lim 1035 if Xlim(2)>Xlim(1) 1036 set(haxes,'XLim',Xlim);% set x limits of frame in axes coordinates 1037 end 1038 if Ylim(2)>Ylim(1) 1039 set(haxes,'YLim',Ylim);% set y limits of frame in axes coordinate 1040 end 1038 1041 end 1039 1042 end -
trunk/src/proj_field.m
r42 r46 90 90 return 91 91 end 92 FieldData 92 93 %introduce default field properties (reading old standards) 93 94 if ~isfield(ObjectData,'Style')||~isfield(ObjectData,'Coord')||~isfield(ObjectData,'ProjMode') … … 885 886 ProjData.VarAttribute{nbvar+1}.long_name='abscissa along line'; 886 887 if nbcolor==3 887 ProjData.VarDimName{end}={ XName,'rgb'};888 ProjData.VarDimName{end}={AXName,'rgb'}; 888 889 end 889 890 end … … 1177 1178 for ivar=VarIndex 1178 1179 VarName=FieldData.ListVarName{ivar}; 1179 if ~( ivar==ivar_X | ivar==ivar_Y | ivar==ivar_Z | ivar==ivar_F | ivar==ivar_FF| test_anc(ivar)==1)1180 if ~( ivar==ivar_X || ivar==ivar_Y || ivar==ivar_Z || ivar==ivar_F || ivar==ivar_FF || test_anc(ivar)==1) 1180 1181 ivar_new=ivar_new+1; 1181 1182 ProjData.ListVarName=[ProjData.ListVarName {VarName}]; 1182 1183 ProjData.VarDimName=[ProjData.VarDimName {DimCell}]; 1183 1184 %ProjData.VarDimIndex=[ProjData.VarDimIndex {[1 2]}]; 1184 if isfield(FieldData,'VarAttribute') & length(FieldData.VarAttribute) >=ivar1185 if isfield(FieldData,'VarAttribute') && length(FieldData.VarAttribute) >=ivar 1185 1186 ProjData.VarAttribute{ivar_new+nbcoord}=FieldData.VarAttribute{ivar}; 1186 1187 end … … 1190 1191 eval(['FieldData.' VarName '=FieldData.' VarName '(indsel);']) 1191 1192 end 1192 eval(['ProjData.' VarName '=griddata_uvmat( coord_X,coord_Y,FieldData.' VarName ',coord_x_proj,coord_y_proj'');'])1193 eval(['ProjData.' VarName '=griddata_uvmat(double(coord_X),double(coord_Y),double(FieldData.' VarName '),coord_x_proj,coord_y_proj'');']) 1193 1194 eval(['varline=reshape(ProjData.' VarName ',1,length(coord_y_proj)*length(coord_x_proj));']) 1194 1195 FFlag= isnan(varline); %detect undefined values NaN … … 1517 1518 end 1518 1519 %projection of velocity components in the rotated coordinates 1519 if ~isequal(Phi,0) & length(ivar_U)==11520 if ~isequal(Phi,0) && length(ivar_U)==1 1520 1521 if isempty(ivar_V) 1521 1522 msgbox_uvmat('ERROR','v velocity component missing in proj_field.m') -
trunk/src/series.m
r41 r46 1289 1289 1290 1290 %update the first and last times of the series 1291 if testupdate & isfield(SeriesData,'Time')1291 if testupdate && isfield(SeriesData,'Time') 1292 1292 if ~isempty(SeriesData.Time{1}) 1293 1293 displ_time(handles,SeriesData.Time{1}); … … 1304 1304 %hseries=get(handles.RUN,'parent'); 1305 1305 set(0,'CurrentFigure',handles.figure1) 1306 if isequal(get(handles.GetObject,'V alue'),1)1306 if isequal(get(handles.GetObject,'Visible'),'on') && isequal(get(handles.GetObject,'Value'),1) 1307 1307 Series.GetObject=1; 1308 1308 GetObject_Callback(hObject, eventdata, handles) … … 1311 1311 end 1312 1312 SeriesData=get(handles.figure1,'UserData'); 1313 % if isfield(SeriesData,'sethandles')1314 % if iscell(SeriesData.sethandles)1315 % Series.sethandles=SeriesData.sethandles{1};1316 % else1317 % Series.sethandles=SeriesData.sethandles;%retrieve the handles of the set_object interface (to define projection objects)1318 % end1319 % end1320 1313 1321 1314 %reinitiate waitbar position … … 1506 1499 Series.Action=action;%name of the processing programme 1507 1500 set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 1508 drawnow 1501 1509 1502 if length(RootPath)>1 1510 1503 h_fun(num_i1_cell,num_i2_cell,num_j1_cell,num_j2_cell,Series); … … 2083 2076 if value 2084 2077 set(handles.GetObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow 2085 DataInit.ParentButton=handles.GetObject;2078 % DataInit.ParentButton=handles.GetObject; 2086 2079 hset_object=findobj(allchild(0),'Name','set_object');%find the set_object interface handle 2087 2080 if ishandle(hset_object) 2088 [SeriesData.hset_object,SeriesData.sethandles]=set_object(DataInit); %open the set_object interface 2081 uistack(hset_object,'top') 2082 %[SeriesData.hset_object,SeriesData.sethandles]=set_object(DataInit); %open the set_object interface 2089 2083 else 2090 2084 %get the object file … … 2094 2088 '*.xml', '.xml files '; ... 2095 2089 '*.mat', '.mat matlab files '}, ... 2096 'Pick a file',defaultname{1});2090 'Pick an xml object file (or use uvmat to create it)',defaultname{1}); 2097 2091 fileinput=[PathName FileName];%complete file name 2098 2092 testblank=findstr(fileinput,' ');%look for blanks … … 2123 2117 end 2124 2118 else 2125 set(handles.GetObject,'BackgroundColor',[0 1 0])%put activated buttons to green2119 set(handles.GetObject,'BackgroundColor',[0.7 0.7 0.7])%put activated buttons to green 2126 2120 % if isfield(SeriesData,'hset_object')&& ishandle(SeriesData.hset_object) 2127 2121 % close(SeriesData.hset_object) … … 2217 2211 set(handles.path_transform,'String',fileparts(func.file)); %show the path to the senlected function 2218 2212 2219 2213 %------------------------------------------------------------- 2214 %generates a series of file names with reference numbers between range1 and 2215 %range2 with increment incr. The reference number num_ref is the image number at the middle of the 2216 %image pair. The set of first numbers num1 of the image pairs is also 2217 %given as output 2218 %------------------------------------------------------ 2219 function [num_i1,num_i2,num_j1,num_j2,nbmissing]=netseries_generator(filebase,subdir,mode,first_i,incr_i,last_i,first_j,incr_j,last_j) 2220 [Path,Name]=fileparts(filebase); 2221 filebasesub=fullfile(Path,subdir,Name); 2222 filecell={};%default 2223 num_i1=[]; 2224 num_i2=[]; 2225 num_j1=[]; 2226 num_j2=[]; 2227 ind0_i=first_i:incr_i:last_i; 2228 nbcolumn=length(ind0_i); 2229 ind0_j=first_j:incr_j:last_j; 2230 nbline=length(ind0_j); 2231 if isequal(mode,'#_ab') 2232 dirpair=dir([filebasesub '*_*.nc']); 2233 elseif isequal(mode,'bursts')|isequal(mode,'series(Dj)') 2234 dirpair=dir([filebasesub '_*_*-*.nc']); 2235 elseif isequal(mode,'series(Di)') 2236 dirpair=dir([filebasesub '_*-*_*.nc']); 2237 else 2238 errordlg('option *|* not yet implemented') 2239 return 2240 end 2241 if isempty(dirpair) 2242 errordlg('no pair detected in the selected range') 2243 return 2244 end 2245 %ind0_i=first_i:incr_i:last_i; 2246 %nbcolumn=length(ind0_i); 2247 %dirpair=dir([filebasesub '_*_*-*.nc']); 2248 if isequal(mode,'bursts')|isequal(mode,'#_ab') 2249 icount=0; 2250 for ifile=1:length(dirpair) 2251 [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); 2252 2253 % if isempty(str2num(str_1)) 2254 % dirpair(ifile).name 2255 % end 2256 num1_r=str2num(str_1); 2257 if isequal(RootFile,Name) & ~isempty(num1_r) 2258 num_i1(ifile)=num1_r; 2259 num_a(ifile)=stra2num(str_a); 2260 num_b(ifile)=stra2num(str_b); 2261 % icount=icount+1; 2262 end 2263 end 2264 length(dirpair) 2265 % num_j=floor((num_a+num_b)/2); %list of reference indices of the detected files 2266 test_range= (num_i1 >=first_i)&(num_i1<= last_i);% =1 when both numbers are in the range 2267 ind_i=((num_i1-first_i)/incr_i)+1;%indices i in the list of prescribed file indices 2268 select=find(test_range &(floor(ind_i)==ind_i));%selected indices of num_i1 in the file directory 2269 ind_i=ind_i(select);%set of selected indices ind_i 2270 [ind_i,indsort]=sort(ind_i);%sorted list of ind_i 2271 select=select(indsort); 2272 num_i1=num_i1(select); 2273 num_a=num_a(select); 2274 num_b=num_b(select); 2275 dirpair=dirpair(select); 2276 [ind_remove]=find_pairs(dirpair,ind_i,nbcolumn); 2277 ind_i(ind_remove)=[]; 2278 num_a(ind_remove)=[]; 2279 num_b(ind_remove)=[]; 2280 num_j1=zeros(1,nbcolumn);%default 2281 num_j2=num_j1; 2282 num_j1(ind_i)=num_a; 2283 num_j2(ind_i)=num_b; 2284 num_i1=first_i:incr_i:last_i; 2285 num_i2=num_i1; 2286 nbmissing=nbcolumn-length(ind_i); 2287 2288 elseif isequal(mode,'series(Di)') 2289 %ind0_i=first_i:incr_i:last_i; 2290 %nbcolumn=length(ind0_i); 2291 %ind0_j=first_j:incr_j:last_j; 2292 %nbline=length(ind0_j); 2293 %dirpair=dir([filebasesub '_*-*_*.nc']); 2294 for ifile=1:length(dirpair) 2295 [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); 2296 num_i1_r(ifile)=str2num(str_1); 2297 num_i2_r(ifile)=str2num(str_2); 2298 num_j(ifile)=str2num(str_a); 2299 end 2300 num_i=floor((num_i1_r+num_i2_r)/2); %list of reference indices of the detected files 2301 test_range= (num_i >=first_i)&(num_i<= last_i)&(num_j >=first_j)&(num_j<= last_j);% =1 when both numbers are in the range 2302 ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices 2303 ind_j=((num_j-first_j)/incr_j)+1; 2304 ind_ij=ind_j+nbline*(ind_i-1);%indices in the reshhaped series of prescribed file indices 2305 select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory 2306 ind_ij=ind_ij(select);%set of selected indices ind_ij 2307 [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij 2308 select=select(indsort); 2309 num_i1_r=num_i1_r(select); 2310 num_i2_r=num_i2_r(select); 2311 % num_j=num_j(select); 2312 dirpair=dirpair(select); 2313 [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ; 2314 ind_ij(ind_remove)=[]; 2315 num_i1_r(ind_remove)=[]; 2316 num_i2_r(ind_remove)=[]; 2317 num_i1=zeros(1,nbline*nbcolumn);%default 2318 num_i2=num_i1; 2319 num_i1(ind_ij)=num_i1_r; 2320 num_j2(ind_ij)=num_i2_r; 2321 num_i1=reshape(num_i1,nbline,nbcolumn); 2322 num_i2=reshape(num_i2,nbline,nbcolumn); 2323 num_j1=meshgrid(ind0_i,ind0_j); 2324 num_j2=num_j1; 2325 nbmissing=nbline*nbcolumn-length(ind_ij); 2326 elseif isequal(mode,'series(Dj)') 2327 % ind0_i=first_i:incr_i:last_i; 2328 % nbcolumn=length(ind0_i); 2329 % ind0_j=first_j:incr_j:last_j; 2330 % nbline=length(ind0_j); 2331 % dirpair=dir([filebasesub '_*_*-*.nc']); 2332 for ifile=1:length(dirpair) 2333 [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); 2334 num_i(ifile)=str2num(str_1); 2335 num_a(ifile)=str2num(str_a); 2336 num_b(ifile)=str2num(str_b); 2337 end 2338 num_j=floor((num_a+num_b)/2); %list of reference indices of the detected files 2339 test_range= (num_i >=first_i)&(num_i<= last_i)&(num_j >=first_j)&(num_j<= last_j);% =1 when both numbers are in the range 2340 ind_i=((num_i-first_i)/incr_i)+1;%indices i and j in the list of prescribed file indices 2341 ind_j=((num_j-first_j)/incr_j)+1; 2342 ind_ij=ind_j+nbline*(ind_i-1);%indices in the reshhaped series of prescribed file indices 2343 select=find(test_range &(floor(ind_i)==ind_i)&(floor(ind_j)==ind_j));%selected indices in the file directory 2344 ind_ij=ind_ij(select);%set of selected indices ind_ij 2345 [ind_ij,indsort]=sort(ind_ij);%sorted list of ind_ij 2346 select=select(indsort); 2347 num_i=num_i(select); 2348 num_a=num_a(select); 2349 num_b=num_b(select); 2350 dirpair=dirpair(select); 2351 [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ; 2352 ind_ij(ind_remove)=[]; 2353 num_a(ind_remove)=[]; 2354 num_b(ind_remove)=[]; 2355 num_j1=zeros(1,nbline*nbcolumn);%default 2356 num_j2=num_j1; 2357 num_j1(ind_ij)=num_a; 2358 num_j2(ind_ij)=num_b; 2359 num_j1=reshape(num_j1,nbline,nbcolumn); 2360 num_j2=reshape(num_j2,nbline,nbcolumn); 2361 num_i1=meshgrid(ind0_i,ind0_j); 2362 num_i2=num_i1; 2363 nbmissing=nbline*nbcolumn-length(ind_ij); 2364 % for i=1:length(indsel);%A SUPPRIMER ULTERIEUREMENT 2365 % if indsel(i)==0 2366 % filecell{i}=''; 2367 % else 2368 % Name=dirpair(indsel(i)).name; 2369 % filecell{i}=fullfile(Path,subdir,Name); 2370 % end 2371 % end 2372 %else 2373 % errordlg('option *|* not yet implemented') 2374 % return 2375 end 2220 2376 2221 2377 function path_transform_Callback(hObject, eventdata, handles) -
trunk/src/set_grid.m
r38 r46 288 288 t=xmltree(fileinput); 289 289 s=convert(t); 290 %Display title291 title=set_title(s.Style,s.ProjMode);%update the title292 % menu=get(handles.TITLE,'String')293 % for iline=1:length(menu)294 % if isequal(menu{iline},title)295 % set(handles.TITLE,'Value',iline)296 % break297 % end298 % end299 % TITLE_Callback(hObject, eventdata, handles)300 % teststyle=0;301 % if isfield(s,'Style')302 % menu=get(handles.ObjectStyle,'String');303 % for iline=1:length(menu)304 % if isequal(menu{iline},s.Style)305 % set(handles.ObjectStyle,'Value',iline)306 % teststyle=1;307 % break308 % end309 % end310 % end311 % if teststyle==0;312 % s.Style='points';313 % set(handles.ObjectStyle,'Value',1); %default (points)314 % end315 290 testmode=0; 316 291 if isfield(s,'ProjMode') … … 476 451 imageB=get(handles.image_2,'String'); 477 452 testB=1; 478 if isempty(imageA) | isequal(imageA,'')479 if isempty(imageB) | isequal(imageB,'')453 if isempty(imageA) || isequal(imageA,'') 454 if isempty(imageB) || isequal(imageB,'') 480 455 msgbox_uvmat('ERROR','at least one image file name must be introduced') 481 456 else … … 494 469 end 495 470 [Pathsub,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(imageA); 496 form=imformats(ext( [2:end]));471 form=imformats(ext(2:end)); 497 472 if isempty(form)% if the extension corresponds to an image format recognized by Matlab 498 msgbox_uvmat('ERROR',['error in read_image.m: ' imageA ' is not an image name recognized by Matlab '])473 msgbox_uvmat('ERROR',['error: ' imageA ' is not an image name recognized by Matlab ']) 499 474 return 500 475 end … … 524 499 form=imformats(ext([2:end])); 525 500 if isempty(form)% if the extension corresponds to an image format recognized by Matlab 526 msgbox_uvmat('ERROR',['error in read_image.m: ' imageB ' is not an image name recognized by Matlab '])501 msgbox_uvmat('ERROR',['error: ' imageB ' is not an image name recognized by Matlab ']) 527 502 return 528 503 end … … 601 576 602 577 603 %------------------------------------------------604 function TITLE=set_title(Style,ProjMode)605 %------------------------------------------------606 if isequal(Style,'points')607 TITLE='POINTS';608 elseif isequal(Style,'line')|isequal(Style,'polyline')609 TITLE='LINE';610 elseif isequal(Style,'plane')611 TITLE='PLANE';612 elseif isequal(Style,'volume')613 TITLE='VOLUME';614 elseif isequal(Style,'polygon')|isequal(Style,'rectangle')|isequal(Style,'ellipse')615 if isequal(ProjMode,'inside')|isequal(ProjMode,'outside')616 TITLE='PATCH';617 else618 TITLE='LINE';619 end620 end621 622 623 578 % --- Executes on slider movement. 624 579 function z_slider_Callback(hObject, eventdata, handles) -
trunk/src/struct2nc_toolbox.m
r19 r46 89 89 siz=size(VarVal); 90 90 VarDimIndex=Data.VarDimIndex{ivar}; %indices of the variable dimensions in the list of dimensions 91 VarDimName=Data.VarDimName{ivar}; %NEW92 if ischar(VarDimName) %NEW93 VarDimName={VarDimName}; %NEW94 end %NEW95 testrange=(numel(VarDimName)==1 && strcmp(VarDimName{1},ListVarName{ivar}) && numel(VarVal)==2); %NEW91 VarDimName=Data.VarDimName{ivar}; 92 if ischar(VarDimName) 93 VarDimName={VarDimName}; 94 end 95 testrange=(numel(VarDimName)==1 && strcmp(VarDimName{1},ListVarName{ivar}) && numel(VarVal)==2); 96 96 testline=isequal(length(siz),2) & isequal(siz(1),1)& isequal(siz(2), Data.DimValue(VarDimIndex)); 97 97 testcolumn=isequal(length(siz),2) & isequal(siz(1), Data.DimValue(VarDimIndex))& isequal(siz(2),1); … … 100 100 break 101 101 end 102 if testline || testrange %NEW102 if testline || testrange 103 103 dimname=Data.ListDimName{VarDimIndex}; 104 if testrange %NEW105 VarVal=linspace(VarVal(1),VarVal(2),Data.DimValue(VarDimIndex)); %NEW106 end %NEW104 if testrange 105 VarVal=linspace(VarVal(1),VarVal(2),Data.DimValue(VarDimIndex)); 106 end 107 107 nc{ListVarName{ivar}}=ncfloat(dimname);%vector of x coordinates 108 108 nc{ListVarName{ivar}}(:) = VarVal'; … … 113 113 %write variable attributes 114 114 if testattr 115 for ivar =1:length(VarAttribute)116 if isstruct(VarAttribute{ivar })117 attr_names=fields(VarAttribute{ivar });115 for ivarattr=1:length(VarAttribute) 116 if isstruct(VarAttribute{ivarattr}) 117 attr_names=fields(VarAttribute{ivarattr}); 118 118 for iattr=1:length(attr_names) 119 119 eval(['attr_val=VarAttribute{ivar}.' attr_names{iattr} ';']);
Note: See TracChangeset
for help on using the changeset viewer.