Loading dates & times into Matlab


/ Published in: MatLab
Save to your folder(s)

Load dates & times into Matlab as text files, then convert to datenum so I can do something useful with them.


Copy this code and paste it in your HTML
  1.  
  2. directorypath='H:\SSW_scripts\';
  3.  
  4. %load in the data
  5. %=====================
  6. %text files in format 'dd mm yyyy hh mm s'
  7. disturbancetimes=load([directorypath,'CR_disturbance_time3.txt']);
  8.  
  9.  
  10. clear CR_d
  11. %convert time to datevec
  12. CR_d(:,1)=datenum(disturbancetimes(:,1),disturbancetimes(:,2),disturbancetimes(:,3),disturbancetimes(:,4),...
  13. disturbancetimes(:,5),disturbancetimes(:,6));

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.