feather plot help please?

  • Follow


Hi all,
        Here is the code i wrote for feather plot with time series data (u and v) (wind data). When i get the graph after running this code the dates on the x axis is incorrect.

%% Get Data

[fn,pn] = uigetfile('*.data', 'Open the txt file to be read');
file=fullfile(pn,fn);


count=1;

fid3=fopen(fn,'rt');


%%second=0;

while(~feof(fid3)) 
   in1=fgetl(fid3);
   if(isequal(in1,''))
       break;
   end
   date=sscanf(in1,'%s',1);
   set1 = find(date=='-',1,'first');
   set2 = find(date=='-',1,'last');   
   day = str2double(date(1:set1-1));
   month = date(set1+1:set2-1);
   if(month == 'Jan')
       month = 1;
   end
      if(month == 'Feb')
       month = 2;
      end
      if(month == 'Mar')
       month = 3;
      end
      if(month == 'Apr')
       month = 4;
      end
      if(month == 'May')
       month = 5;
      end
      if(month == 'Jun')
       month = 6;
      end
      if(month == 'Jul')
       month = 7;
      end
      if(month == 'Aug')
       month = 8;
      end
      if(month == 'Sep')
       month = 9;
      end
         if(month == 'Oct')
       month = 10;
         end
         if(month == 'Nov')
       month = 11;
         end
         if(month == 'Dec')
       month = 12;
   end
   year = str2double(date(set2+1:set2+4));
   
   if(year < 100)
     year=year+2000;
   end
   
   
   time=sscanf(in1,'%*s %s',1);
   loc=find(time==':');
   hour=str2double(time(1:loc-1));
   minute=str2double(time(loc+1:loc+2));
   
   vector_time=[year month day hour minute second];
   field.value1(count)=sscanf(in1,'%*s %*s %f',1);
   field.value2(count)=sscanf(in1,'%*s %*s %*f %f',1);
   field.value3(count)=sscanf(in1,'%*s %*s %*f %*f %f',1);
   field.value4(count)=sscanf(in1,'%*s %*s %*f %*f %*f %f',1);
   field.value5(count)=sscanf(in1,'%*s %*s %*f %*f %*f %*f %f',1);
   temp=datestr(vector_time);
   field.time(count)=datenum(temp);
   count=count+1;
end


%% Feather plot

axis([min(field.time(:)) max(field.time(:)) -10 10]);
feather(field.value4(:), field.value5(:));
datetick('x',2,'keepticks'); 
hold('on');
0
Reply Bettaiyya 5/28/2010 12:40:07 AM


0 Replies
416 Views

(page loaded in 0.016 seconds)

Similiar Articles:







7/27/2012 2:00:00 AM


Reply: