from Number to Ordinal String Converter by Bill Higley
Converts an integer into its ordinal string.

num2ordstr(in)
%% NUM2ORDSTR(in)
%% This function turns a number into an ordinal string, ie
%% 1 becomes 'first', 2 becomes 'second'.  After 'twentieth', the number
%% is used with the appropriate 'st, 'nd', 'rd', or 'th'.  Useful for
%% instructionary dialog boxes, etc.

function out = num2ordstr(in)

finaldigit = mod(in,10);
switch in
case 1
    out = 'first';
case 2
    out = 'second';
case 3
    out = 'third';
case 4
    out = 'fourth';
case 5
    out = 'fifth';
case 6
    out = 'sixth';
case 7
    out = 'seventh';
case 8
    out = 'eigth';
case 9
    out = 'ninth';
case 10
    out = 'tenth';
case 11
    out = 'eleventh';
case 12
    out = 'twelvth';
case 13
    out = 'thirteenth';
case 14
    out = 'fourteenth';
case 15
    out = 'fifteenth';
case 16
    out = 'sixteenth';
case 17
    out = 'seventeenth';
case 18
    out = 'eighteenth';
case 19
    out = 'ninteenth';
case 20
    out = 'twentieth';
otherwise
    switch finaldigit
    case 1
        suffix = 'st';
    case 2
        suffix = 'nd';
    case 3
        suffix = 'rd';
    otherwise
        suffix = 'th';
    end
    out = [num2str(in) suffix];
end

Contact us at files@mathworks.com