Write me a matlab function which returns the current date in yyyy-mm-dd format
- User
Write me a matlab function which returns the current date in yyyy-mm-dd format
- Assistant
function currentDate = getCurrentDate() currentDate = datestr(now, 'yyyy-mm-dd'); end
- User
make it fancy
- Assistant
Here's a fancier version that adds some graphics to the output:
function currentDate = getCurrentDate() currentDate = datestr(now, 'yyyy-mm-dd'); fig = figure('Color', 'white', 'Position', [500, 500, 200, 100]); text(0.5, 0.5, currentDate, 'FontSize', 30, 'HorizontalAlignment', 'center'); axis off; end
This function creates a small figure window and displays the current date in large font in the center. The window is sized and positioned to appear in the middle of the screen. The "axis off" command removes the axis labels and tick marks to create a sleek and minimalistic appearance.