Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How can I convert a string of alphabetical characters to a vector of their numerical equivalent ie A->1, B->2 etc

1 回表示 (過去 30 日間)
Tim
Tim 2013 年 12 月 4 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I need to find a way to quickly convert large lists of dictionary words into a vector of integers corresponding to the letters number in the alphabet (1-26). ie. 'BAT' -> [2 1 20]. What is the best way to achieve this result? Thanks in advance for your help!

回答 (1 件)

dpb
dpb 2013 年 12 月 4 日
>> double('BAT'-'@')
ans =
2 1 20
>>

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by