MATLAB: Decimals to Roman Numerals

dec2romandecimalsdecimals to roman numeralshomeworkindividual digitsromanroman numerals

Hello I'm student currently studying MATLAB and I have a project to turn Decimals to Roman Numerals. I wanted to know if it was possible to make matlab recognize individual digits. eg. 1000 x1=1 x2=0 x3=0 x4=0
as then my code will follow into:
for number > 1000 if x1=1 roman= 'M' if x1= 2 roman='MM'
any help would be greatly appreciated thanks.

Best Answer

a = 1000;
a = num2str(a);
a = a - '0';
a is a row vector, where each element is one of your x's