This preview shows page 1. Sign up to view the full content.
Unformatted text preview: % If a number ends in 4, 5, 6, 7, 8, 9, or 0, or it ends in 11, 12, or % 13, use 'th'. % function name = ordinalNum(num) str = num2str(num); if length(str) >= 2 && str(end-1) == '1' % ends in 11-19 suffix = 'th'; else switch str(end) case '1' suffix = 'st'; case '2' suffix = 'nd'; case '3' suffix = 'rd'; otherwise suffix = 'th'; end end name = [str suffix]; end...
View Full Document
This note was uploaded on 10/22/2009 for the course CS 1371 taught by Professor Stallworth during the Fall '08 term at Georgia Institute of Technology.
- Fall '08