Hi, I'm trying to get my logical outputs of (1/0) to match up for each value of a matrix I input and it's only giving me the last result. What do I need to change to get it to save each output?
Inputs:
month = 3 3 3day = 12 12 12year = 2014 2014 2014Date2 = '2014-03-12 19:06:10' '2014-03-12 19:06:20' '2014-03-12 19:06:30'
Code is as follows:
if (month > 3) & (month <11) DST=true;elseif ((month < 3) | (month > 11)) DST= false;elseif (month == 3) if (day > 14) DST=true; elseif (day < 8) DST=false; else DOW = weekday(Date2,'yyyy-mm-dd'); if (DOW == 1) DST=true; elseif (DOW > 1) if ((DOW == 2) & (day > 8)) DST = true; elseif ((DOW == 3) & (day > 9)) DST = true; elseif ((DOW == 4) & (day > 10)) DST = true; elseif ((DOW == 5) & (day > 11)) DST = true; elseif ((DOW == 6) & (day > 12)) DST = true; elseif ((DOW == 7) & (day > 13)) DST = true; else DST = false; end end endelseif (month == 11) if (day > 7) DST=false; else DOW = weekday(Date2,'mm/dd/yyyy'); if (DOW == 1) DST=false; elseif (DOW > 1) if ((DOW == 2) & (day < 2)) DST = true; elseif ((DOW == 3) & (day <3)) DST = true; elseif ((DOW == 4) & (day <4)) DST = true; elseif ((DOW == 5) & (day <5)) DST = true; elseif ((DOW == 6) & (day <6)) DST = true; elseif ((DOW == 7) & (day <7)) DST = true; else DST = false; end end endelse DST = false;end
Also, any suggestions for improvement are welcome. I'm new to this, hence the really basic coding.
Best Answer