I use a function called uigetdate to get the date as a number (e.g. 736850). I then want to find the number of elapsed days for any given year, starting with jan 1. My code is as follows and I would rather put it in a loop than have to keep typing different years (the only thing that changes are the years). note: GMT_day1 equals something like 164. How do I make a loop for this?
day1 = uigetdate;day1 = floor(day1);day2 = uigetdate;day2 = floor(day2);if day1 > datenum(2016,12,31) && day2 < datenum(2017,12,31) time1 = datenum(2016,12,31); GMT_day1 = day1 - time1; GMT_day2 = day2 - time1;elseif day1 > datenum(2017,12,31) && day2 < datenum(2018,12,31) time1 = datenum(2017,12,31); GMT_day1 = day1 - time1; GMT_day2 = day2 - time1;
Best Answer