Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 124154

Submitted on 6 Aug 2012 by Aurelien Queffurust

Correct

66Size
Leading solution size is 18.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
n = 1;
Title_correct = 'Times 2 - START HERE';
assert(strcmp(Cody_Title(n),Title_correct))
url =
http://www.mathworks.com/matlabcentral/cody/?term=id%3A1
s =
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
  <head>
      <meta http-equiv="X-UA-Compatible" content="IE=8"/>
      	<script type="text/javascript" src="/includes_content/nextgen/scripts/jquery/jquery-latest.js"></script>
      <!-- START OF GLOBAL NAV -->
  <link rel="stylesheet" href="/matlabcentral/css/sitewide.css" type="text/css">
  <link rel="stylesheet" href="/matlabcentral/css/mlc.css" type="text/css">
  <!--[if lt IE 7]>
  <link href="/matlabcentral/css/ie6down.css" type="text/css" rel="stylesheet">
  <![endif]-->
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta name="keywords" content="file exchange, matlab answers, newsgroup access, link exchange, matlab blog, matlab central, simulink blog, matlab community, matlab and simulink community">
    <link rel="stylesheet" type="text/css" media="print" href="/matlabcentral/css/print.css" />
    <title>MATLAB Cody - MATLAB Central</title>
    <link rel="stylesheet" type="text/css" href="/matlabcentral/css/cody.css">
<link href="/matlabcentral/cody/stylesheets/960.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<link href="/matlabcentral/cody/stylesheets/application.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<link href="/matlabcentral/cody/stylesheets/editor.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<link href="/matlabcentral/cody/stylesheets/jquery.jqplot.min.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<script src="/matlabcentral/cody/javascripts/jquery_ujs.js?1341602076" type="text/javascript"></script>
<script src="/matlabcentral/cody/javascripts/jquery-ui.min.js?1341602076" type="text/javascript"></script>
<script src="/matlabcentral/cody/javascripts/application.js?1341602076" type="text/javascript"></script>
<meta content="authenticity_token" name="csrf-param" />
<meta content="DLKM7GMBSO/QeMpgyQNqEjOKNKF3rXZaKff+0Uz8VAU=" name="csrf-token" />
  </head>
    <body>
      <div id="header">
  <div class="wrapper">
  <!--put nothing in left div - only 11px wide shadow -->
    <div class="main">
        	<div id="logo"><a href="/matlabcentral/" title="MATLAB Central Home"><img src="/matlabcentral/images/mlclogo-whitebgd.gif" alt="MATLAB Central" /></a></div>
        <div id="headertools">
<script language="JavaScript1.3" type="text/javascript">
function submitForm(query){
	choice = document.forms['searchForm'].elements['search_submit'].value;
	if (choice == "entire1" || choice == "contest" || choice == "matlabcentral" || choice == "blogs"){
	   var newElem = document.createElement("input");
	   newElem.type = "hidden";
	   newElem.name = "q";
	   newElem.value = query.value;
	   document.forms['searchForm'].appendChild(newElem);
	   submit_action = '/searchresults/';
	}
	switch(choice){
	   case "matlabcentral":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "matlabcentral";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 0;
	      break
	   case "fileexchange":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/fileexchange/";
	      selected_index = 1;
	      break
	   case "answers":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/answers/";
	      selected_index = 2;
	      break
	   case "cssm":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "search_string";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
		  submit_action = "/matlabcentral/newsreader/search_results";
	      selected_index = 3;
	      break
	   case "linkexchange":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/linkexchange/";
	      selected_index = 4;
	      break
	   case "blogs":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "blogs";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 5;
	      break
	   case "trendy":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "search";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/trendy";
	      selected_index = 6;
	      break
	   case "cody":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/cody/";
	      selected_index = 7;
	      break
	   case "contest":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "contest";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 8;
	      break
	   case "entire1":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "entiresite";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 9;
	      break
	   default:
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "entiresite";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 9;
	      break
	}
	document.forms['searchForm'].elements['search_submit'].selectedIndex = selected_index;
	document.forms['searchForm'].elements['query'].value = query.value;
	document.forms['searchForm'].action = submit_action;
}
</SCRIPT>
  <form name="searchForm" method="GET" action="" style="margin:0px; margin-top:5px; font-size:90%" onSubmit="submitForm(query)">
          <label for="search">Search: </label>
        <select name="search_submit" style="font-size:9px ">
         	 <option value = "matlabcentral">MATLAB Central</option>
          	<option value = "fileexchange">&nbsp;&nbsp;&nbsp;File Exchange</option>
          	<option value = "answers">&nbsp;&nbsp;&nbsp;Answers</option>
            <option value = "cssm">&nbsp;&nbsp;&nbsp;Newsgroup</option>
          	<option value = "linkexchange">&nbsp;&nbsp;&nbsp;Link Exchange</option>
          	<option value = "blogs">&nbsp;&nbsp;&nbsp;Blogs</option>
          	<option value = "trendy">&nbsp;&nbsp;&nbsp;Trendy</option>
          	<option value = "cody" selected>&nbsp;&nbsp;&nbsp;Cody</option>
          	<option value = "contest">&nbsp;&nbsp;&nbsp;Contest</option>
          <option value = "entire1">MathWorks.com</option>
        </select>
<input type="text" name="query" size="10" class="formelem" value="">
<input type="submit" value="Go" class="formelem gobutton" >
</form>
		  <ol id="access2">
  <li class="first">
    <a href="http://www.mathworks.com/accesslogin/createProfile.do?uri=http%3A%2F%2Fwww.mathworks.com%2Fmatlabcentral%2Fcody%2F%3Fterm%3Did%253A1" rel="nofollow">Create Account</a>
  </li>
  <li>
    <a href="https://www.mathworks.com/accesslogin/index_fe.do?uri=http%3A%2F%2Fwww.mathworks.com%2Fmatlabcentral%2Fcody%2F%3Fterm%3Did%253A1" rel="nofollow">Log In</a>
  </li>
</ol>
      </div>
        <div id="globalnav">
        <!-- from includes/global_nav.html -->
        <ol>
                <li class=";" >
                        <a href="/matlabcentral/fileexchange/">File Exchange</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/answers/">Answers</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/newsreader/">Newsgroup</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/linkexchange/">Link Exchange</a>
                </li>
                <li class=";" >
                        <a href="http://blogs.mathworks.com/">Blogs</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/trendy">Trendy</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/cody">Cody</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/contest/">Contest</a>
                </li>
                <li class="icon mathworks" >
                        <a href="/">MathWorks.com</a>
                </li>
        </ol>
      </div>
    </div>
  </div>
</div>
      	<div class="container_240">
    	<div class="cody_content_container">
        	<div class="grid_35 push_2">
	<div id="localnav_container" class="localnav_container">
    	<div class="localnav">
      		<ul>
        		<li class="active"><a href="/matlabcentral/cody/problems" id="cody_problems_list_id">Problems</a></li>
				<li class=""><a href="/matlabcentral/cody/solutions" id="cody_all_solutions_list_id">Solutions</a></li>
        		<li class=""><a href=...
2
Pass
 
%%
n = 2;
Title_correct = 'Make the vector [1 2 3 4 5 6 7 8 9 10]';
assert(strcmp(Cody_Title(n),Title_correct))
url =
http://www.mathworks.com/matlabcentral/cody/?term=id%3A2
s =
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
  <head>
      <meta http-equiv="X-UA-Compatible" content="IE=8"/>
      	<script type="text/javascript" src="/includes_content/nextgen/scripts/jquery/jquery-latest.js"></script>
      <!-- START OF GLOBAL NAV -->
  <link rel="stylesheet" href="/matlabcentral/css/sitewide.css" type="text/css">
  <link rel="stylesheet" href="/matlabcentral/css/mlc.css" type="text/css">
  <!--[if lt IE 7]>
  <link href="/matlabcentral/css/ie6down.css" type="text/css" rel="stylesheet">
  <![endif]-->
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta name="keywords" content="file exchange, matlab answers, newsgroup access, link exchange, matlab blog, matlab central, simulink blog, matlab community, matlab and simulink community">
    <link rel="stylesheet" type="text/css" media="print" href="/matlabcentral/css/print.css" />
    <title>MATLAB Cody - MATLAB Central</title>
    <link rel="stylesheet" type="text/css" href="/matlabcentral/css/cody.css">
<link href="/matlabcentral/cody/stylesheets/960.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<link href="/matlabcentral/cody/stylesheets/application.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<link href="/matlabcentral/cody/stylesheets/editor.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<link href="/matlabcentral/cody/stylesheets/jquery.jqplot.min.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<script src="/matlabcentral/cody/javascripts/jquery_ujs.js?1341602076" type="text/javascript"></script>
<script src="/matlabcentral/cody/javascripts/jquery-ui.min.js?1341602076" type="text/javascript"></script>
<script src="/matlabcentral/cody/javascripts/application.js?1341602076" type="text/javascript"></script>
<meta content="authenticity_token" name="csrf-param" />
<meta content="HI7XhuU8ASWy4R084z5xkeSNWQI68vbiLnt5hNuVBc0=" name="csrf-token" />
  </head>
    <body>
      <div id="header">
  <div class="wrapper">
  <!--put nothing in left div - only 11px wide shadow -->
    <div class="main">
        	<div id="logo"><a href="/matlabcentral/" title="MATLAB Central Home"><img src="/matlabcentral/images/mlclogo-whitebgd.gif" alt="MATLAB Central" /></a></div>
        <div id="headertools">
<script language="JavaScript1.3" type="text/javascript">
function submitForm(query){
	choice = document.forms['searchForm'].elements['search_submit'].value;
	if (choice == "entire1" || choice == "contest" || choice == "matlabcentral" || choice == "blogs"){
	   var newElem = document.createElement("input");
	   newElem.type = "hidden";
	   newElem.name = "q";
	   newElem.value = query.value;
	   document.forms['searchForm'].appendChild(newElem);
	   submit_action = '/searchresults/';
	}
	switch(choice){
	   case "matlabcentral":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "matlabcentral";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 0;
	      break
	   case "fileexchange":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/fileexchange/";
	      selected_index = 1;
	      break
	   case "answers":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/answers/";
	      selected_index = 2;
	      break
	   case "cssm":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "search_string";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
		  submit_action = "/matlabcentral/newsreader/search_results";
	      selected_index = 3;
	      break
	   case "linkexchange":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/linkexchange/";
	      selected_index = 4;
	      break
	   case "blogs":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "blogs";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 5;
	      break
	   case "trendy":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "search";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/trendy";
	      selected_index = 6;
	      break
	   case "cody":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/cody/";
	      selected_index = 7;
	      break
	   case "contest":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "contest";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 8;
	      break
	   case "entire1":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "entiresite";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 9;
	      break
	   default:
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "entiresite";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 9;
	      break
	}
	document.forms['searchForm'].elements['search_submit'].selectedIndex = selected_index;
	document.forms['searchForm'].elements['query'].value = query.value;
	document.forms['searchForm'].action = submit_action;
}
</SCRIPT>
  <form name="searchForm" method="GET" action="" style="margin:0px; margin-top:5px; font-size:90%" onSubmit="submitForm(query)">
          <label for="search">Search: </label>
        <select name="search_submit" style="font-size:9px ">
         	 <option value = "matlabcentral">MATLAB Central</option>
          	<option value = "fileexchange">&nbsp;&nbsp;&nbsp;File Exchange</option>
          	<option value = "answers">&nbsp;&nbsp;&nbsp;Answers</option>
            <option value = "cssm">&nbsp;&nbsp;&nbsp;Newsgroup</option>
          	<option value = "linkexchange">&nbsp;&nbsp;&nbsp;Link Exchange</option>
          	<option value = "blogs">&nbsp;&nbsp;&nbsp;Blogs</option>
          	<option value = "trendy">&nbsp;&nbsp;&nbsp;Trendy</option>
          	<option value = "cody" selected>&nbsp;&nbsp;&nbsp;Cody</option>
          	<option value = "contest">&nbsp;&nbsp;&nbsp;Contest</option>
          <option value = "entire1">MathWorks.com</option>
        </select>
<input type="text" name="query" size="10" class="formelem" value="">
<input type="submit" value="Go" class="formelem gobutton" >
</form>
		  <ol id="access2">
  <li class="first">
    <a href="http://www.mathworks.com/accesslogin/createProfile.do?uri=http%3A%2F%2Fwww.mathworks.com%2Fmatlabcentral%2Fcody%2F%3Fterm%3Did%253A2" rel="nofollow">Create Account</a>
  </li>
  <li>
    <a href="https://www.mathworks.com/accesslogin/index_fe.do?uri=http%3A%2F%2Fwww.mathworks.com%2Fmatlabcentral%2Fcody%2F%3Fterm%3Did%253A2" rel="nofollow">Log In</a>
  </li>
</ol>
      </div>
        <div id="globalnav">
        <!-- from includes/global_nav.html -->
        <ol>
                <li class=";" >
                        <a href="/matlabcentral/fileexchange/">File Exchange</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/answers/">Answers</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/newsreader/">Newsgroup</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/linkexchange/">Link Exchange</a>
                </li>
                <li class=";" >
                        <a href="http://blogs.mathworks.com/">Blogs</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/trendy">Trendy</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/cody">Cody</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/contest/">Contest</a>
                </li>
                <li class="icon mathworks" >
                        <a href="/">MathWorks.com</a>
                </li>
        </ol>
      </div>
    </div>
  </div>
</div>
      	<div class="container_240">
    	<div class="cody_content_container">
        	<div class="grid_35 push_2">
	<div id="localnav_container" class="localnav_container">
    	<div class="localnav">
      		<ul>
        		<li class="active"><a href="/matlabcentral/cody/problems" id="cody_problems_list_id">Problems</a></li>
				<li class=""><a href="/matlabcentral/cody/solutions" id="cody_all_solutions_list_id">Solutions</a></li>
        		<li class=""><a href=...
3
Pass
 
%%
n = 110;
Title_correct = 'Make an N-dimensional Multiplication Table';
% This problem hurts my head
assert(strcmp(Cody_Title(n),Title_correct))
url =
http://www.mathworks.com/matlabcentral/cody/?term=id%3A110
s =
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
  <head>
      <meta http-equiv="X-UA-Compatible" content="IE=8"/>
      	<script type="text/javascript" src="/includes_content/nextgen/scripts/jquery/jquery-latest.js"></script>
      <!-- START OF GLOBAL NAV -->
  <link rel="stylesheet" href="/matlabcentral/css/sitewide.css" type="text/css">
  <link rel="stylesheet" href="/matlabcentral/css/mlc.css" type="text/css">
  <!--[if lt IE 7]>
  <link href="/matlabcentral/css/ie6down.css" type="text/css" rel="stylesheet">
  <![endif]-->
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta name="keywords" content="file exchange, matlab answers, newsgroup access, link exchange, matlab blog, matlab central, simulink blog, matlab community, matlab and simulink community">
    <link rel="stylesheet" type="text/css" media="print" href="/matlabcentral/css/print.css" />
    <title>MATLAB Cody - MATLAB Central</title>
    <link rel="stylesheet" type="text/css" href="/matlabcentral/css/cody.css">
<link href="/matlabcentral/cody/stylesheets/960.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<link href="/matlabcentral/cody/stylesheets/application.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<link href="/matlabcentral/cody/stylesheets/editor.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<link href="/matlabcentral/cody/stylesheets/jquery.jqplot.min.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<script src="/matlabcentral/cody/javascripts/jquery_ujs.js?1341602076" type="text/javascript"></script>
<script src="/matlabcentral/cody/javascripts/jquery-ui.min.js?1341602076" type="text/javascript"></script>
<script src="/matlabcentral/cody/javascripts/application.js?1341602076" type="text/javascript"></script>
<meta content="authenticity_token" name="csrf-param" />
<meta content="QNGm2ZdJguz8Vsw2vaqR4BAO4pF/hNCWftBswDAS1WE=" name="csrf-token" />
  </head>
    <body>
      <div id="header">
  <div class="wrapper">
  <!--put nothing in left div - only 11px wide shadow -->
    <div class="main">
        	<div id="logo"><a href="/matlabcentral/" title="MATLAB Central Home"><img src="/matlabcentral/images/mlclogo-whitebgd.gif" alt="MATLAB Central" /></a></div>
        <div id="headertools">
<script language="JavaScript1.3" type="text/javascript">
function submitForm(query){
	choice = document.forms['searchForm'].elements['search_submit'].value;
	if (choice == "entire1" || choice == "contest" || choice == "matlabcentral" || choice == "blogs"){
	   var newElem = document.createElement("input");
	   newElem.type = "hidden";
	   newElem.name = "q";
	   newElem.value = query.value;
	   document.forms['searchForm'].appendChild(newElem);
	   submit_action = '/searchresults/';
	}
	switch(choice){
	   case "matlabcentral":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "matlabcentral";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 0;
	      break
	   case "fileexchange":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/fileexchange/";
	      selected_index = 1;
	      break
	   case "answers":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/answers/";
	      selected_index = 2;
	      break
	   case "cssm":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "search_string";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
		  submit_action = "/matlabcentral/newsreader/search_results";
	      selected_index = 3;
	      break
	   case "linkexchange":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/linkexchange/";
	      selected_index = 4;
	      break
	   case "blogs":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "blogs";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 5;
	      break
	   case "trendy":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "search";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/trendy";
	      selected_index = 6;
	      break
	   case "cody":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/cody/";
	      selected_index = 7;
	      break
	   case "contest":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "contest";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 8;
	      break
	   case "entire1":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "entiresite";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 9;
	      break
	   default:
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "entiresite";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 9;
	      break
	}
	document.forms['searchForm'].elements['search_submit'].selectedIndex = selected_index;
	document.forms['searchForm'].elements['query'].value = query.value;
	document.forms['searchForm'].action = submit_action;
}
</SCRIPT>
  <form name="searchForm" method="GET" action="" style="margin:0px; margin-top:5px; font-size:90%" onSubmit="submitForm(query)">
          <label for="search">Search: </label>
        <select name="search_submit" style="font-size:9px ">
         	 <option value = "matlabcentral">MATLAB Central</option>
          	<option value = "fileexchange">&nbsp;&nbsp;&nbsp;File Exchange</option>
          	<option value = "answers">&nbsp;&nbsp;&nbsp;Answers</option>
            <option value = "cssm">&nbsp;&nbsp;&nbsp;Newsgroup</option>
          	<option value = "linkexchange">&nbsp;&nbsp;&nbsp;Link Exchange</option>
          	<option value = "blogs">&nbsp;&nbsp;&nbsp;Blogs</option>
          	<option value = "trendy">&nbsp;&nbsp;&nbsp;Trendy</option>
          	<option value = "cody" selected>&nbsp;&nbsp;&nbsp;Cody</option>
          	<option value = "contest">&nbsp;&nbsp;&nbsp;Contest</option>
          <option value = "entire1">MathWorks.com</option>
        </select>
<input type="text" name="query" size="10" class="formelem" value="">
<input type="submit" value="Go" class="formelem gobutton" >
</form>
		  <ol id="access2">
  <li class="first">
    <a href="http://www.mathworks.com/accesslogin/createProfile.do?uri=http%3A%2F%2Fwww.mathworks.com%2Fmatlabcentral%2Fcody%2F%3Fterm%3Did%253A110" rel="nofollow">Create Account</a>
  </li>
  <li>
    <a href="https://www.mathworks.com/accesslogin/index_fe.do?uri=http%3A%2F%2Fwww.mathworks.com%2Fmatlabcentral%2Fcody%2F%3Fterm%3Did%253A110" rel="nofollow">Log In</a>
  </li>
</ol>
      </div>
        <div id="globalnav">
        <!-- from includes/global_nav.html -->
        <ol>
                <li class=";" >
                        <a href="/matlabcentral/fileexchange/">File Exchange</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/answers/">Answers</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/newsreader/">Newsgroup</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/linkexchange/">Link Exchange</a>
                </li>
                <li class=";" >
                        <a href="http://blogs.mathworks.com/">Blogs</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/trendy">Trendy</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/cody">Cody</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/contest/">Contest</a>
                </li>
                <li class="icon mathworks" >
                        <a href="/">MathWorks.com</a>
                </li>
        </ol>
      </div>
    </div>
  </div>
</div>
      	<div class="container_240">
    	<div class="cody_content_container">
        	<div class="grid_35 push_2">
	<div id="localnav_container" class="localnav_container">
    	<div class="localnav">
      		<ul>
        		<li class="active"><a href="/matlabcentral/cody/problems" id="cody_problems_list_id">Problems</a></li>
				<li class=""><a href="/matlabcentral/cody/solutions" id="cody_all_solutions_list_id">Solutions</a></li>
        		<li class=""><a...
4
Pass
 
%%
n = 808;
Title_correct = 'Hamming Weight - Fast';
assert(strcmp(Cody_Title(n),Title_correct))
url =
http://www.mathworks.com/matlabcentral/cody/?term=id%3A808
s =
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
  <head>
      <meta http-equiv="X-UA-Compatible" content="IE=8"/>
      	<script type="text/javascript" src="/includes_content/nextgen/scripts/jquery/jquery-latest.js"></script>
      <!-- START OF GLOBAL NAV -->
  <link rel="stylesheet" href="/matlabcentral/css/sitewide.css" type="text/css">
  <link rel="stylesheet" href="/matlabcentral/css/mlc.css" type="text/css">
  <!--[if lt IE 7]>
  <link href="/matlabcentral/css/ie6down.css" type="text/css" rel="stylesheet">
  <![endif]-->
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta name="keywords" content="file exchange, matlab answers, newsgroup access, link exchange, matlab blog, matlab central, simulink blog, matlab community, matlab and simulink community">
    <link rel="stylesheet" type="text/css" media="print" href="/matlabcentral/css/print.css" />
    <title>MATLAB Cody - MATLAB Central</title>
    <link rel="stylesheet" type="text/css" href="/matlabcentral/css/cody.css">
<link href="/matlabcentral/cody/stylesheets/960.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<link href="/matlabcentral/cody/stylesheets/application.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<link href="/matlabcentral/cody/stylesheets/editor.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<link href="/matlabcentral/cody/stylesheets/jquery.jqplot.min.css?1341602076" media="screen" rel="stylesheet" type="text/css" />
<script src="/matlabcentral/cody/javascripts/jquery_ujs.js?1341602076" type="text/javascript"></script>
<script src="/matlabcentral/cody/javascripts/jquery-ui.min.js?1341602076" type="text/javascript"></script>
<script src="/matlabcentral/cody/javascripts/application.js?1341602076" type="text/javascript"></script>
<meta content="authenticity_token" name="csrf-param" />
<meta content="8z4WTWGixRsC+ez3LN5zSE4wVU7TxHPtFoYOeUKnUb8=" name="csrf-token" />
  </head>
    <body>
      <div id="header">
  <div class="wrapper">
  <!--put nothing in left div - only 11px wide shadow -->
    <div class="main">
        	<div id="logo"><a href="/matlabcentral/" title="MATLAB Central Home"><img src="/matlabcentral/images/mlclogo-whitebgd.gif" alt="MATLAB Central" /></a></div>
        <div id="headertools">
<script language="JavaScript1.3" type="text/javascript">
function submitForm(query){
	choice = document.forms['searchForm'].elements['search_submit'].value;
	if (choice == "entire1" || choice == "contest" || choice == "matlabcentral" || choice == "blogs"){
	   var newElem = document.createElement("input");
	   newElem.type = "hidden";
	   newElem.name = "q";
	   newElem.value = query.value;
	   document.forms['searchForm'].appendChild(newElem);
	   submit_action = '/searchresults/';
	}
	switch(choice){
	   case "matlabcentral":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "matlabcentral";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 0;
	      break
	   case "fileexchange":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/fileexchange/";
	      selected_index = 1;
	      break
	   case "answers":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/answers/";
	      selected_index = 2;
	      break
	   case "cssm":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "search_string";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
		  submit_action = "/matlabcentral/newsreader/search_results";
	      selected_index = 3;
	      break
	   case "linkexchange":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/linkexchange/";
	      selected_index = 4;
	      break
	   case "blogs":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "blogs";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 5;
	      break
	   case "trendy":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "search";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/trendy";
	      selected_index = 6;
	      break
	   case "cody":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "term";
	      newElem.value = query.value;
	      newElem.classname = "formelem";
	      document.forms['searchForm'].appendChild(newElem);
	      submit_action = "/matlabcentral/cody/";
	      selected_index = 7;
	      break
	   case "contest":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "contest";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 8;
	      break
	   case "entire1":
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "entiresite";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 9;
	      break
	   default:
	      var newElem = document.createElement("input");
	      newElem.type = "hidden";
	      newElem.name = "c[]";
	      newElem.value = "entiresite";
	      document.forms['searchForm'].appendChild(newElem);
	      selected_index = 9;
	      break
	}
	document.forms['searchForm'].elements['search_submit'].selectedIndex = selected_index;
	document.forms['searchForm'].elements['query'].value = query.value;
	document.forms['searchForm'].action = submit_action;
}
</SCRIPT>
  <form name="searchForm" method="GET" action="" style="margin:0px; margin-top:5px; font-size:90%" onSubmit="submitForm(query)">
          <label for="search">Search: </label>
        <select name="search_submit" style="font-size:9px ">
         	 <option value = "matlabcentral">MATLAB Central</option>
          	<option value = "fileexchange">&nbsp;&nbsp;&nbsp;File Exchange</option>
          	<option value = "answers">&nbsp;&nbsp;&nbsp;Answers</option>
            <option value = "cssm">&nbsp;&nbsp;&nbsp;Newsgroup</option>
          	<option value = "linkexchange">&nbsp;&nbsp;&nbsp;Link Exchange</option>
          	<option value = "blogs">&nbsp;&nbsp;&nbsp;Blogs</option>
          	<option value = "trendy">&nbsp;&nbsp;&nbsp;Trendy</option>
          	<option value = "cody" selected>&nbsp;&nbsp;&nbsp;Cody</option>
          	<option value = "contest">&nbsp;&nbsp;&nbsp;Contest</option>
          <option value = "entire1">MathWorks.com</option>
        </select>
<input type="text" name="query" size="10" class="formelem" value="">
<input type="submit" value="Go" class="formelem gobutton" >
</form>
		  <ol id="access2">
  <li class="first">
    <a href="http://www.mathworks.com/accesslogin/createProfile.do?uri=http%3A%2F%2Fwww.mathworks.com%2Fmatlabcentral%2Fcody%2F%3Fterm%3Did%253A808" rel="nofollow">Create Account</a>
  </li>
  <li>
    <a href="https://www.mathworks.com/accesslogin/index_fe.do?uri=http%3A%2F%2Fwww.mathworks.com%2Fmatlabcentral%2Fcody%2F%3Fterm%3Did%253A808" rel="nofollow">Log In</a>
  </li>
</ol>
      </div>
        <div id="globalnav">
        <!-- from includes/global_nav.html -->
        <ol>
                <li class=";" >
                        <a href="/matlabcentral/fileexchange/">File Exchange</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/answers/">Answers</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/newsreader/">Newsgroup</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/linkexchange/">Link Exchange</a>
                </li>
                <li class=";" >
                        <a href="http://blogs.mathworks.com/">Blogs</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/trendy">Trendy</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/cody">Cody</a>
                </li>
                <li class=";" >
                        <a href="/matlabcentral/contest/">Contest</a>
                </li>
                <li class="icon mathworks" >
                        <a href="/">MathWorks.com</a>
                </li>
        </ol>
      </div>
    </div>
  </div>
</div>
      	<div class="container_240">
    	<div class="cody_content_container">
        	<div class="grid_35 push_2">
	<div id="localnav_container" class="localnav_container">
    	<div class="localnav">
      		<ul>
        		<li class="active"><a href="/matlabcentral/cody/problems" id="cody_problems_list_id">Problems</a></li>
				<li class=""><a href="/matlabcentral/cody/solutions" id="cody_all_solutions_list_id">Solutions</a></li>
        		<li class=""><a...