MATLAB: How to change a number of base n to base m

MATLABmatlab function

i want to write a code that changes the base b of a number
for example :
124 can be written as 01444 in base of 5
112 can be written as 01300 in base of 4
the input should be a numbe x in decimal base and a new base b
the output should be the number x in base b

Best Answer

John D'Errico created the base2base function to do exactly this. Follow that link to the File Exchange.
>> base2base('124',10,5)
ans =
'444'
(I think you got your example wrong.)