In honor of the start of the 2007/2008 season, a function that provides RGB color values for all 32 NFL teams...
Well, I know nothing about this site and my sister was the mathematical genious in MY family, but having been asked to design a piece of jewelry using one of the team's colors, I came across this page. The red is kind of "questionable", and if I was one to download files indiscriminantly to my computer, I'm sure I am one of the few people to whom this WOULD be of value. Matlab, maybe not so much, but ME, yes. Didn't take advantage of it though, not sure what kind of file it is, but I WOULD love to know the RGB color value of the red in the Bucs colors. . .would help me know what type of red to use when I design the piece. . . .this girly-girl doesn't plan to EVER attend a football game of any kind. . . . .
I'll admit, I'm still wondering why Matlab needs an NFL color mapping utility. 8-)
Given that, I like how the author has cleaned it up. In context, its a good code if this is something that you have a need for as a user.
I was debating whether this code was worth a rating of 4 or 5. Initially, I wanted to make it a 4, since it does not seem to be of real value to many people. On the other hand, this is by far the best code I've seen so far on the file exchange to supply the colors of all NFL teams. In that context, I'll give it a 5 rating. ;-)
Defaulting to the Jets over the Giants is a serious flaw.
Slightly more seriously, from a coding point of view the code could have been more simply written, yet be more flexible using either strmatch or strncmp. This would allow the user to shorten the names. For example, you could then call it as nflcolor('cinc') and not get an error as long as the shortening was unambiguous.
This would also simplify the code, allowing it to be written as just an index into an array of colors, rather than as a massive switch/case statement.
Addressed issues raised by reviewer. Code no longer uses a case statement, code now allows for partial matches for team city and name. Also added an sample image...
Create scripts with code, output, and formatted text in a single executable document.