Problem 61065. Convert Hexavigesimal to Decimal

NASA (Ned’s Alien-Spying Agency) have made contact with a 13-fingered race from the planet Genai. Naturally, Ned’s shadowy operatives intend to communicate with the aliens via the universal language of mathematics. However, because of their digitally prodigious physiology, the Genaians use a base-26 number system. This is convenient for humans with an English keyboard, because base-26 can be represented with the letters of the English alphabet: 'a' = 0, 'b' = 1, …, 'z' = 25.
Given an n-element char vector of the characters ‘a’-’z’, return the (decimal) numerical value the vector represents in base 26, treating each character as a digit.
For example, the text ‘aloha’ would correspond to a vector of values [0 11 14 7 0], thus representing the base-26 value 202982 = 11*26^3 + 14*26^2 + 7*26.
Examples
d = char2num26('funfunfun')
d = 1208856210289
d = char2num26('matlab')
d = 142917893
d = char2num26('nasa')
d = 228956
Assumptions
The input will be given as a row vector of characters from 'a' to 'z' (lower case). Concepts like public-key encryption aren't on the agenda yet, so the input vector will be between 1 and 8 elements, meaning the result will be exactly representable in double precision.

Solution Stats

85.71% Correct | 14.29% Incorrect
Last Solution submitted on Nov 12, 2025

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers45

Suggested Problems

More from this Author33

Problem Tags

Community Treasure Hunt

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

Start Hunting!