I have the following data:
Names={A1 A2 B1 B2 C1 C2 C3}
Doserate=(2.2 3.4 6.4 3.4 2.3 4.5 7.5)
Time=(5 7.8 9 3.5 10.2 5.6 7.8)
The order of Doserate and Time is such they correspond to Names. I would like to make groups starting with the same letter so that I can perform calculations using Doserate and Time corresponding to that group. Names can vary to even more letters (A-Z) or more numbers like (A1-A30).
How can I group these entries?
You can use a loop to extract the first character in each cell entry (you can probably use
cellfun()as well) and then a call tounique()to extract the unique characters. Its third output, namedcin my example, will be your groups. ThusDoserate(c(c==2))will return allDoserateentries whereNamesstart withB.