showDate - %this will index the final two characters of the...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function str = showDate(num_mon,num_day,num_yr) %function to match a nnumeric date and return the date in string with the %format of MMM-DD-YY or MMM-D-YY; for month, take the first three letters %of the month; for day, use the numerical day; for year, use the last two %digits of the year %usage: str = showDate(num_mon,num_day,num_yr) months = ['Jan';'Feb';'Mar';'Apr';'May';'Jun';'Jul';'Aug';'Sep';'Oct';'Nov';. .. 'Dec']; year = num2str(num_yr(end)); %this will convert the numerical year to a string yy = year(end-1:end);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %this will index the final two characters of the year and place them in the %variable yy dd = num2str(num_day); %this will convert the numerical day to a string and place it in the %variable dd mmm = months(num_mon,:); %this will index the given month number to the correct month and place it %in the variable mmm str = sprintf ('%s-%s-%s',mmm,dd,yy); %this will take the string value from mm and place it first followed by a %hyphen, then take the string value form %...
View Full Document

Ask a homework question - tutors are online