InsertDate - Insert date into string. Replaces %y, %m, %d and %t with current year, month, day and time. USAGE out = InsertDate(in) in string to modify
0001 function out = InsertDate(in) 0002 0003 %InsertDate - Insert date into string. 0004 % 0005 % Replaces %y, %m, %d and %t with current year, month, day and time. 0006 % 0007 % USAGE 0008 % 0009 % out = InsertDate(in) 0010 % 0011 % in string to modify 0012 0013 % Copyright (C) 2013 by Michaƫl Zugaro 0014 % 0015 % This program is free software; you can redistribute it and/or modify 0016 % it under the terms of the GNU General Public License as published by 0017 % the Free Software Foundation; either version 3 of the License, or 0018 % (at your option) any later version. 0019 0020 n = clock; 0021 year = int2str(n(1)); 0022 month = int2zstr(n(2),2); 0023 day = int2zstr(n(3),2); 0024 time = [int2zstr(n(4)) '' int2zstr(n(5))]; 0025 0026 out = in; 0027 out = strrep(out,'%y',year); 0028 out = strrep(out,'%m',month); 0029 out = strrep(out,'%d',day); 0030 out = strrep(out,'%t',time);