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 221531

Submitted on 22 Mar 2013 by Christopher

Correct

139Size
Leading solution size is 16.
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
 
%%
s = 'Cl';
y_correct = 17;
assert(isequal(atomicNumber2(s),y_correct))
x =
  Columns 1 through 13
    'H'    'He'    'Li'    'Be'    'B'    'C'    'N'    'O'    'F'    'Ne'    'Na'    'Mg'    'Al'
  Columns 14 through 26
    'Si'    'P'    'S'    'Cl'    'Ar'    'K'    'Ca'    'Sc'    'Ti'    'V'    'Cr'    'Mn'    'Fe'
  Columns 27 through 38
    'Co'    'Ni'    'Cu'    'Zn'    'Ga'    'Ge'    'As'    'Se'    'Br'    'Kr'    'Rb'    'Sr'
  Columns 39 through 50
    'Y'    'Zr'    'Nb'    'Mo'    'Tc'    'Ru'    'Rh'    'Pd'    'Ag'    'Cd'    'In'    'Sn'
  Columns 51 through 62
    'Sb'    'Te'    'I'    'Xe'    'Cs'    'Ba'    'La'    'Ce'    'Pr'    'Nd'    'Pm'    'Sm'
  Columns 63 through 74
    'Eu'    'Gd'    'Tb'    'Dy'    'Ho'    'Er'    'Tm'    'Yb'    'Lu'    'Hf'    'Ta'    'W'
  Columns 75 through 86
    'Re'    'Os'    'Ir'    'Pt'    'Au'    'Hg'    'Tl'    'Pb'    'Bi'    'Po'    'At'    'Rn'
  Columns 87 through 98
    'Fr'    'Ra'    'Ac'    'Th'    'Pa'    'U'    'Np'    'Pu'    'Am'    'Cm'    'Bk'    'Cf'
  Columns 99 through 110
    'Es'    'Fm'    'Md'    'No'    'Lr'    'Rf'    'Db'    'Sg'    'Bh'    'Hs'    'Mt'    'Ds'
  Columns 111 through 113
    'Rg'    'Uub'    'Uut'
2
Pass
 
%%
s = 'Au';
y_correct = 79;
assert(isequal(atomicNumber2(s),y_correct))
x =
  Columns 1 through 13
    'H'    'He'    'Li'    'Be'    'B'    'C'    'N'    'O'    'F'    'Ne'    'Na'    'Mg'    'Al'
  Columns 14 through 26
    'Si'    'P'    'S'    'Cl'    'Ar'    'K'    'Ca'    'Sc'    'Ti'    'V'    'Cr'    'Mn'    'Fe'
  Columns 27 through 38
    'Co'    'Ni'    'Cu'    'Zn'    'Ga'    'Ge'    'As'    'Se'    'Br'    'Kr'    'Rb'    'Sr'
  Columns 39 through 50
    'Y'    'Zr'    'Nb'    'Mo'    'Tc'    'Ru'    'Rh'    'Pd'    'Ag'    'Cd'    'In'    'Sn'
  Columns 51 through 62
    'Sb'    'Te'    'I'    'Xe'    'Cs'    'Ba'    'La'    'Ce'    'Pr'    'Nd'    'Pm'    'Sm'
  Columns 63 through 74
    'Eu'    'Gd'    'Tb'    'Dy'    'Ho'    'Er'    'Tm'    'Yb'    'Lu'    'Hf'    'Ta'    'W'
  Columns 75 through 86
    'Re'    'Os'    'Ir'    'Pt'    'Au'    'Hg'    'Tl'    'Pb'    'Bi'    'Po'    'At'    'Rn'
  Columns 87 through 98
    'Fr'    'Ra'    'Ac'    'Th'    'Pa'    'U'    'Np'    'Pu'    'Am'    'Cm'    'Bk'    'Cf'
  Columns 99 through 110
    'Es'    'Fm'    'Md'    'No'    'Lr'    'Rf'    'Db'    'Sg'    'Bh'    'Hs'    'Mt'    'Ds'
  Columns 111 through 113
    'Rg'    'Uub'    'Uut'
3
Pass
 
%%
s = 'Dy';
y_correct = 66;
assert(isequal(atomicNumber2(s),y_correct))
x =
  Columns 1 through 13
    'H'    'He'    'Li'    'Be'    'B'    'C'    'N'    'O'    'F'    'Ne'    'Na'    'Mg'    'Al'
  Columns 14 through 26
    'Si'    'P'    'S'    'Cl'    'Ar'    'K'    'Ca'    'Sc'    'Ti'    'V'    'Cr'    'Mn'    'Fe'
  Columns 27 through 38
    'Co'    'Ni'    'Cu'    'Zn'    'Ga'    'Ge'    'As'    'Se'    'Br'    'Kr'    'Rb'    'Sr'
  Columns 39 through 50
    'Y'    'Zr'    'Nb'    'Mo'    'Tc'    'Ru'    'Rh'    'Pd'    'Ag'    'Cd'    'In'    'Sn'
  Columns 51 through 62
    'Sb'    'Te'    'I'    'Xe'    'Cs'    'Ba'    'La'    'Ce'    'Pr'    'Nd'    'Pm'    'Sm'
  Columns 63 through 74
    'Eu'    'Gd'    'Tb'    'Dy'    'Ho'    'Er'    'Tm'    'Yb'    'Lu'    'Hf'    'Ta'    'W'
  Columns 75 through 86
    'Re'    'Os'    'Ir'    'Pt'    'Au'    'Hg'    'Tl'    'Pb'    'Bi'    'Po'    'At'    'Rn'
  Columns 87 through 98
    'Fr'    'Ra'    'Ac'    'Th'    'Pa'    'U'    'Np'    'Pu'    'Am'    'Cm'    'Bk'    'Cf'
  Columns 99 through 110
    'Es'    'Fm'    'Md'    'No'    'Lr'    'Rf'    'Db'    'Sg'    'Bh'    'Hs'    'Mt'    'Ds'
  Columns 111 through 113
    'Rg'    'Uub'    'Uut'
4
Pass
 
%%
s = 'O';
y_correct = 8;
assert(isequal(atomicNumber2(s),y_correct))
x =
  Columns 1 through 13
    'H'    'He'    'Li'    'Be'    'B'    'C'    'N'    'O'    'F'    'Ne'    'Na'    'Mg'    'Al'
  Columns 14 through 26
    'Si'    'P'    'S'    'Cl'    'Ar'    'K'    'Ca'    'Sc'    'Ti'    'V'    'Cr'    'Mn'    'Fe'
  Columns 27 through 38
    'Co'    'Ni'    'Cu'    'Zn'    'Ga'    'Ge'    'As'    'Se'    'Br'    'Kr'    'Rb'    'Sr'
  Columns 39 through 50
    'Y'    'Zr'    'Nb'    'Mo'    'Tc'    'Ru'    'Rh'    'Pd'    'Ag'    'Cd'    'In'    'Sn'
  Columns 51 through 62
    'Sb'    'Te'    'I'    'Xe'    'Cs'    'Ba'    'La'    'Ce'    'Pr'    'Nd'    'Pm'    'Sm'
  Columns 63 through 74
    'Eu'    'Gd'    'Tb'    'Dy'    'Ho'    'Er'    'Tm'    'Yb'    'Lu'    'Hf'    'Ta'    'W'
  Columns 75 through 86
    'Re'    'Os'    'Ir'    'Pt'    'Au'    'Hg'    'Tl'    'Pb'    'Bi'    'Po'    'At'    'Rn'
  Columns 87 through 98
    'Fr'    'Ra'    'Ac'    'Th'    'Pa'    'U'    'Np'    'Pu'    'Am'    'Cm'    'Bk'    'Cf'
  Columns 99 through 110
    'Es'    'Fm'    'Md'    'No'    'Lr'    'Rf'    'Db'    'Sg'    'Bh'    'Hs'    'Mt'    'Ds'
  Columns 111 through 113
    'Rg'    'Uub'    'Uut'
5
Pass
 
%%
s = 'Ge';
y_correct = 32;
assert(isequal(atomicNumber2(s),y_correct))
x =
  Columns 1 through 13
    'H'    'He'    'Li'    'Be'    'B'    'C'    'N'    'O'    'F'    'Ne'    'Na'    'Mg'    'Al'
  Columns 14 through 26
    'Si'    'P'    'S'    'Cl'    'Ar'    'K'    'Ca'    'Sc'    'Ti'    'V'    'Cr'    'Mn'    'Fe'
  Columns 27 through 38
    'Co'    'Ni'    'Cu'    'Zn'    'Ga'    'Ge'    'As'    'Se'    'Br'    'Kr'    'Rb'    'Sr'
  Columns 39 through 50
    'Y'    'Zr'    'Nb'    'Mo'    'Tc'    'Ru'    'Rh'    'Pd'    'Ag'    'Cd'    'In'    'Sn'
  Columns 51 through 62
    'Sb'    'Te'    'I'    'Xe'    'Cs'    'Ba'    'La'    'Ce'    'Pr'    'Nd'    'Pm'    'Sm'
  Columns 63 through 74
    'Eu'    'Gd'    'Tb'    'Dy'    'Ho'    'Er'    'Tm'    'Yb'    'Lu'    'Hf'    'Ta'    'W'
  Columns 75 through 86
    'Re'    'Os'    'Ir'    'Pt'    'Au'    'Hg'    'Tl'    'Pb'    'Bi'    'Po'    'At'    'Rn'
  Columns 87 through 98
    'Fr'    'Ra'    'Ac'    'Th'    'Pa'    'U'    'Np'    'Pu'    'Am'    'Cm'    'Bk'    'Cf'
  Columns 99 through 110
    'Es'    'Fm'    'Md'    'No'    'Lr'    'Rf'    'Db'    'Sg'    'Bh'    'Hs'    'Mt'    'Ds'
  Columns 111 through 113
    'Rg'    'Uub'    'Uut'
6
Pass
 
%%
s = 'Uut';
y_correct = 113;
assert(isequal(atomicNumber2(s),y_correct))
x =
  Columns 1 through 13
    'H'    'He'    'Li'    'Be'    'B'    'C'    'N'    'O'    'F'    'Ne'    'Na'    'Mg'    'Al'
  Columns 14 through 26
    'Si'    'P'    'S'    'Cl'    'Ar'    'K'    'Ca'    'Sc'    'Ti'    'V'    'Cr'    'Mn'    'Fe'
  Columns 27 through 38
    'Co'    'Ni'    'Cu'    'Zn'    'Ga'    'Ge'    'As'    'Se'    'Br'    'Kr'    'Rb'    'Sr'
  Columns 39 through 50
    'Y'    'Zr'    'Nb'    'Mo'    'Tc'    'Ru'    'Rh'    'Pd'    'Ag'    'Cd'    'In'    'Sn'
  Columns 51 through 62
    'Sb'    'Te'    'I'    'Xe'    'Cs'    'Ba'    'La'    'Ce'    'Pr'    'Nd'    'Pm'    'Sm'
  Columns 63 through 74
    'Eu'    'Gd'    'Tb'    'Dy'    'Ho'    'Er'    'Tm'    'Yb'    'Lu'    'Hf'    'Ta'    'W'
  Columns 75 through 86
    'Re'    'Os'    'Ir'    'Pt'    'Au'    'Hg'    'Tl'    'Pb'    'Bi'    'Po'    'At'    'Rn'
  Columns 87 through 98
    'Fr'    'Ra'    'Ac'    'Th'    'Pa'    'U'    'Np'    'Pu'    'Am'    'Cm'    'Bk'    'Cf'
  Columns 99 through 110
    'Es'    'Fm'    'Md'    'No'    'Lr'    'Rf'    'Db'    'Sg'    'Bh'    'Hs'    'Mt'    'Ds'
  Columns 111 through 113
    'Rg'    'Uub'    'Uut'
7
Pass
 
%%
s = 'C';
y_correct = 6;
assert(isequal(atomicNumber2(s),y_correct))
x =
  Columns 1 through 13
    'H'    'He'    'Li'    'Be'    'B'    'C'    'N'    'O'    'F'    'Ne'    'Na'    'Mg'    'Al'
  Columns 14 through 26
    'Si'    'P'    'S'    'Cl'    'Ar'    'K'    'Ca'    'Sc'    'Ti'    'V'    'Cr'    'Mn'    'Fe'
  Columns 27 through 38
    'Co'    'Ni'    'Cu'    'Zn'    'Ga'    'Ge'    'As'    'Se'    'Br'    'Kr'    'Rb'    'Sr'
  Columns 39 through 50
    'Y'    'Zr'    'Nb'    'Mo'    'Tc'    'Ru'    'Rh'    'Pd'    'Ag'    'Cd'    'In'    'Sn'
  Columns 51 through 62
    'Sb'    'Te'    'I'    'Xe'    'Cs'    'Ba'    'La'    'Ce'    'Pr'    'Nd'    'Pm'    'Sm'
  Columns 63 through 74
    'Eu'    'Gd'    'Tb'    'Dy'    'Ho'    'Er'    'Tm'    'Yb'    'Lu'    'Hf'    'Ta'    'W'
  Columns 75 through 86
    'Re'    'Os'    'Ir'    'Pt'    'Au'    'Hg'    'Tl'    'Pb'    'Bi'    'Po'    'At'    'Rn'
  Columns 87 through 98
    'Fr'    'Ra'    'Ac'    'Th'    'Pa'    'U'    'Np'    'Pu'    'Am'    'Cm'    'Bk'    'Cf'
  Columns 99 through 110
    'Es'    'Fm'    'Md'    'No'    'Lr'    'Rf'    'Db'    'Sg'    'Bh'    'Hs'    'Mt'    'Ds'
  Columns 111 through 113
    'Rg'    'Uub'    'Uut'
8
Pass
 
%%
s = 'Xe';
y_correct = 54;
assert(isequal(atomicNumber2(s),y_correct))
x =
  Columns 1 through 13
    'H'    'He'    'Li'    'Be'    'B'    'C'    'N'    'O'    'F'    'Ne'    'Na'    'Mg'    'Al'
  Columns 14 through 26
    'Si'    'P'    'S'    'Cl'    'Ar'    'K'    'Ca'    'Sc'    'Ti'    'V'    'Cr'    'Mn'    'Fe'
  Columns 27 through 38
    'Co'    'Ni'    'Cu'    'Zn'    'Ga'    'Ge'    'As'    'Se'    'Br'    'Kr'    'Rb'    'Sr'
  Columns 39 through 50
    'Y'    'Zr'    'Nb'    'Mo'    'Tc'    'Ru'    'Rh'    'Pd'    'Ag'    'Cd'    'In'    'Sn'
  Columns 51 through 62
    'Sb'    'Te'    'I'    'Xe'    'Cs'    'Ba'    'La'    'Ce'    'Pr'    'Nd'    'Pm'    'Sm'
  Columns 63 through 74
    'Eu'    'Gd'    'Tb'    'Dy'    'Ho'    'Er'    'Tm'    'Yb'    'Lu'    'Hf'    'Ta'    'W'
  Columns 75 through 86
    'Re'    'Os'    'Ir'    'Pt'    'Au'    'Hg'    'Tl'    'Pb'    'Bi'    'Po'    'At'    'Rn'
  Columns 87 through 98
    'Fr'    'Ra'    'Ac'    'Th'    'Pa'    'U'    'Np'    'Pu'    'Am'    'Cm'    'Bk'    'Cf'
  Columns 99 through 110
    'Es'    'Fm'    'Md'    'No'    'Lr'    'Rf'    'Db'    'Sg'    'Bh'    'Hs'    'Mt'    'Ds'
  Columns 111 through 113
    'Rg'    'Uub'    'Uut'
9
Pass
 
%%
s = 'Hg';
y_correct = 80;
assert(isequal(atomicNumber2(s),y_correct))
x =
  Columns 1 through 13
    'H'    'He'    'Li'    'Be'    'B'    'C'    'N'    'O'    'F'    'Ne'    'Na'    'Mg'    'Al'
  Columns 14 through 26
    'Si'    'P'    'S'    'Cl'    'Ar'    'K'    'Ca'    'Sc'    'Ti'    'V'    'Cr'    'Mn'    'Fe'
  Columns 27 through 38
    'Co'    'Ni'    'Cu'    'Zn'    'Ga'    'Ge'    'As'    'Se'    'Br'    'Kr'    'Rb'    'Sr'
  Columns 39 through 50
    'Y'    'Zr'    'Nb'    'Mo'    'Tc'    'Ru'    'Rh'    'Pd'    'Ag'    'Cd'    'In'    'Sn'
  Columns 51 through 62
    'Sb'    'Te'    'I'    'Xe'    'Cs'    'Ba'    'La'    'Ce'    'Pr'    'Nd'    'Pm'    'Sm'
  Columns 63 through 74
    'Eu'    'Gd'    'Tb'    'Dy'    'Ho'    'Er'    'Tm'    'Yb'    'Lu'    'Hf'    'Ta'    'W'
  Columns 75 through 86
    'Re'    'Os'    'Ir'    'Pt'    'Au'    'Hg'    'Tl'    'Pb'    'Bi'    'Po'    'At'    'Rn'
  Columns 87 through 98
    'Fr'    'Ra'    'Ac'    'Th'    'Pa'    'U'    'Np'    'Pu'    'Am'    'Cm'    'Bk'    'Cf'
  Columns 99 through 110
    'Es'    'Fm'    'Md'    'No'    'Lr'    'Rf'    'Db'    'Sg'    'Bh'    'Hs'    'Mt'    'Ds'
  Columns 111 through 113
    'Rg'    'Uub'    'Uut'