MATLAB: Representing a number as a matrix

conversionmatrix

Hi, I'm looking for how i would be able to seperate a number's digits and to then have these stored as a matrix. So for example if the number was 146, this would then be split such that matrix X = [1,4,6] Any help would be greatly appreciated. Thanks

Best Answer

For a non-negative integral value:
>> x = 146
x =
146
>> num2str(x) - '0'
ans =
1 4 6
Do you also need to somehow process non-integral values, etc?