Changeset 615 for trunk/src/uvmat.m
- Timestamp:
- Apr 23, 2013, 4:22:08 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r611 r615 850 850 TimeUnit='';%default 851 851 Time=[]; 852 % testima=0; %test for image input853 852 imainfo=[]; 854 853 ColorType='falsecolor'; %default 855 % hhh=[];856 854 UvData.MovieObject{index}=VideoObject; 857 855 if ~isempty(VideoObject) 858 856 imainfo=get(VideoObject); 859 % testima=1;860 857 TimeUnit='s'; 861 858 if isempty(j1_series); %frame index along i 862 Time=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)'; 859 Time=zeros(imainfo.NumberOfFrames+1,2); 860 Time(:,2)=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)'; 863 861 else 864 Time= ones(size(i1_series,1),1)*(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate);862 Time=[0;ones(size(i1_series,3)-1,1)]*(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate); 865 863 end 866 864 set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec … … 2030 2028 2031 2029 %% initialisation 2032 abstime=[];2033 abstime_1=[];2034 dt=[];2035 2030 if ~exist('Field','var') 2036 2031 Field={}; … … 2350 2345 2351 2346 %% display time 2352 testimedoc=0; 2347 abstime=[];%default inputs 2348 abstime_1=[]; 2349 dt=[]; 2353 2350 TimeUnit=''; 2354 if isfield(Field{1},'Time') 2355 abstime=Field{1}.Time;%time read from the netcdf input file 2356 end 2357 if numel(Field)==2 && isfield(Field{2},'Time') 2358 abstime_1=Field{2}.Time;%time read from the netcdf input file 2359 end 2360 if isfield(Field{1},'Dt') 2361 dt=Field{1}.Dt;%dt read from the netcdf input file 2362 if isfield(Field{1},'TimeUnit') 2363 TimeUnit=Field{1}.TimeUnit; 2364 end 2365 elseif numel(Field)==2 && isfield(Field{2},'Dt')%dt obtained from the second field if not defined in the first 2366 dt=Field{2}.Dt;%dt read from the netcdf input file 2367 if isfield(Field{2},'TimeUnit') 2368 TimeUnit=Field{2}.TimeUnit; 2369 end 2370 end 2371 % time from xml file overset previous result 2351 % time from xml file or video movie 2372 2352 if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'Time') 2373 2353 if isempty(num_i2)||isnan(num_i2) … … 2381 2361 end 2382 2362 siz=size(UvData.XmlData{1}.Time); 2383 if ~isempty(num_i1)&& ~isempty(num_i2) && num_i1>=0 &&siz(1)>=max(num_i1 ,num_i2) && siz(2)>=max(num_j1,num_j2)2363 if ~isempty(num_i1)&& ~isempty(num_i2) && num_i1>=0 &&siz(1)>=max(num_i1+1,num_i2+1) && siz(2)>=max(num_j1+1,num_j2+1) 2384 2364 abstime=(UvData.XmlData{1}.Time(num_i1+1,num_j1+1)+UvData.XmlData{1}.Time(num_i2+1,num_j2+1))/2;%overset the time read from files 2385 2365 dt=(UvData.XmlData{1}.Time(num_i2+1,num_j2+1)-UvData.XmlData{1}.Time(num_i1+1,num_j1+1)); … … 2400 2380 end 2401 2381 siz=size(UvData.XmlData{2}.Time); 2402 if ~isempty(i1_1) && siz(1)>=max(i1_1,i2_1) && siz(2)>=max(j1_1,j2_1) 2403 abstime_1=(UvData.XmlData{2}.Time(i1_1,j1_1)+UvData.XmlData{2}.Time(i2_1,j2_1))/2;%overset the time read from files 2404 Field{2}.Dt=(UvData.XmlData{2}.Time(i2_1,j2_1)-UvData.XmlData{2}.Time(i1_1,j1_1)); 2405 end 2406 end 2407 end 2408 if ~isequal(numel(abstime),1) 2409 abstime=[]; 2410 end 2411 if ~isequal(numel(abstime_1),1) 2412 abstime_1=[]; 2413 end 2382 if ~isempty(i1_1) && siz(1)>=max(i1_1+1,i2_1+1) && siz(2)>=max(j1_1+1,j2_1+1) 2383 abstime_1=(UvData.XmlData{2}.Time(i1_1+1,j1_1+1)+UvData.XmlData{2}.Time(i2_1+1,j2_1+1))/2;%overset the time read from files 2384 Field{2}.Dt=(UvData.XmlData{2}.Time(i2_1+1,j2_1+1)-UvData.XmlData{2}.Time(i1_1+1,j1_1+1)); 2385 end 2386 end 2387 end 2388 % if isfield(Field{1},'Time') 2389 % abstime=Field{1}.Time;%time read from the netcdf input file 2390 % end 2391 % if numel(Field)==2 && isfield(Field{2},'Time') 2392 % abstime_1=Field{2}.Time;%time read from the netcdf input file 2393 % end 2394 2395 % look for timing in the input file if not defined in a xml file or movie 2396 if isempty(abstime) 2397 if isfield(Field{1},'Dt') 2398 dt=Field{1}.Dt;%dt read from the netcdf input file 2399 if isfield(Field{1},'TimeUnit') 2400 TimeUnit=Field{1}.TimeUnit; 2401 end 2402 elseif numel(Field)==2 && isfield(Field{2},'Dt')%dt obtained from the second field if not defined in the first 2403 dt=Field{2}.Dt;%dt read from the netcdf input file 2404 if isfield(Field{2},'TimeUnit') 2405 TimeUnit=Field{2}.TimeUnit; 2406 end 2407 end 2408 end 2409 % if ~isequal(numel(abstime),1) 2410 % abstime=[]; 2411 % end 2412 % if ~isequal(numel(abstime_1),1) 2413 % abstime_1=[]; 2414 % end 2414 2415 set(handles.abs_time,'String',num2str(abstime,5)) 2415 2416 set(handles.abs_time_1,'String',num2str(abstime_1,5))
Note: See TracChangeset
for help on using the changeset viewer.