from
Summer Olympic Medals 1896-present
by Bill McKeeman
Ways of looking at the record of summer olympic medals
|
| teamNames()
|
% FILE: teamNames.m
% PURPOSE:
% 1. given the country name, find the index
% 2. given the index, find the country name
% EXAMPLES:
% tn = teamNames(); % the object
% idx = tn.enter('France'); % a name index
% nm = tn.name(idx); % the name at index idx
function o = teamNames()
countries = {}; % none to start
o = public(); % the public interface
function idx = enterName(name)
for idx=1:numel(countries)
if strcmp(name, countries{idx})
return;
end
end
countries{end+1}=name;
idx=numel(countries);
end
function res = getName(idx)
res = countries{idx};
end
function o = public()
o = struct;
o.enter = @enterName;
o.name = @getName;
end
end
% Some of the participating countries
%{
'Algeria'
'Argentina'
'Armenia'
'Australasia'
'Australia'
'Austria'
'Azerbaijan'
'Bahamas'
'Barbados'
'Belarus'
'Belgium'
'Bermuda'
'Bohemia'
'Brazil'
'British West Indies'
'Bulgaria'
'Burundi'
'Cameroon'
'Canada'
'Ceylon'
'Chile'
'China'
'Chinese Taipei'
'Colombia'
'Costa Rica'
'Cote d''Ivoire'
'Croatia'
'Cuba'
'Czech Republic'
'Czechoslovakia'
'Denmark'
'Djibouti'
'Dominican Republic'
'East Germany'
'Ecuador'
'Egypt'
'Estonia'
'Ethiopia'
'Finland'
'France'
'Georgia'
'Germany'
'Ghana'
'Great Britain'
'Greece'
'Guyana'
'Haiti'
'Hong Kong'
'Hungary'
'Iceland'
'Independent'
'India'
'Indonesia'
'Iraq'
'Iran'
'Ireland'
'Israel'
'Italy'
'Jamaica'
'Japan'
'Kazakhstan'
'Kenya'
'Kuwait'
'Kyrgyzstan'
'Latvia'
'Lebanon'
'Lithuania'
'Luxembourg'
'Macedonia'
'Malaysia'
'Mexico'
'Mixed team'
'Moldova'
'Mongolia'
'Morocco'
'Mozambique'
'Namibia'
'New Zealand'
'Netherlands'
'Netherlands Antilles'
'Niger'
'Nigeria'
'North Korea'
'Norway'
'Pakistan'
'Panama'
'Peru'
'Philippines'
'Poland'
'Portugal'
'Puerto Rico'
'Qatar'
'Republic of China'
'Romania'
'Russia'
'Saudi Arabia'
'Senegal'
'Singapore'
'Slovakia'
'Slovenia'
'South Africa'
'South Korea'
'Soviet Union'
'Spain'
'Sri Lanka'
'Suriname'
'Sweden'
'Switzerland'
'Syria'
'Tanzania'
'Thailand'
'Tonga'
'Trinidad and Tobago'
'Tunisia'
'Turkey'
'Uganda'
'Ukraine'
'Unified Team'
'United Arab Republic'
'United States'
'Uzbekistan'
'Uruguay'
'Venezuela'
'Vietnam'
'Virgin Islands'
'West Germany'
'Yugoslavia'
'Zambia'
'Zimbabwe'
%}
|
|
Contact us at files@mathworks.com