I think this is something that Matlab should be able to do, but for some reason I cannot find anything that will allow me to do this.
What I need is to combine the values in three variables to make a new variable. For example, y=2012, m=10, d=10. I want a new variable dttm=20121010 or ymd, with the format as in YYMMDD, so single digits need to have a leading zero. The variable will be part of a filename for a separate program that requires all digits to be 2 digits, hence the redefining of y to YY.
This is what I have so far and obviously, it isn't working. The loop works fine. Please help. Thank you in advance.
[y, m, d,] = datevec(startdaytime,'yyyymmddHH');
if y>=2000
YY = (y-2000);
else y<=1999;
YY = (y-1900);
end
dttm = (YY+m+d,'%02.0f %02.0f %02.0f')
P.S. Before you ask, yes I know Matlab doesn't like leading zeros. Just go with it.