MATLAB: How to assign numeric values to strings in an array

cell arrays

I need to assign specific values to some of these chemical species in an array. I need to set RH equal to 100, OH = 100, and NO = 100 and the rest of the species are equal to 0. The array of species looks like this:
SpeciesName =
'RH'
'OH'
'RO2'
'H2O'
'NO'
'NO2'
'RCHO'
'HO2'
'HNO3'
'H2O2'
'O2'
'ROOH'
'hv'
'O3'

Best Answer

You can use a structure
S = struct('Name', {{'RH' 'OH' 'RO2' 'H20'}}, 'Value', [100 100 0 0])